Skip to content

Commit

Permalink
Adds config to disable shelleo logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladisvell committed Dec 9, 2024
1 parent 7e50571 commit a24353f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
27 changes: 18 additions & 9 deletions code/__HELPERS/shell.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,31 @@
shelleo_ids[seo_id] = TRUE
shelleo_id = "[seo_id]"
break

if(!shelleo_id)
shelleo_id = "[shelleo_ids.len + 1]"
shelleo_ids += shelleo_id
shelleo_ids[shelleo_id] = TRUE

out_file = "[SHELLEO_NAME][shelleo_id][SHELLEO_OUT]"
err_file = "[SHELLEO_NAME][shelleo_id][SHELLEO_ERR]"
if(world.system_type == UNIX)
errorcode = shell("[interpreter] \"[replacetext(command, "\"", "\\\"")]\" > [out_file] 2> [err_file]")
if(CONFIG_GET(flag/enable_shelleo_logging))
if(world.system_type == UNIX)
errorcode = shell("[interpreter] \"[replacetext(command, "\"", "\\\"")]\" > [out_file] 2> [err_file]")
else
errorcode = shell("[interpreter] \"[command]\" > [out_file] 2> [err_file]")
if(fexists(out_file))
stdout = file2text(out_file)
fdel(out_file)
if(fexists(err_file))
stderr = file2text(err_file)
fdel(err_file)
else
errorcode = shell("[interpreter] \"[command]\" > [out_file] 2> [err_file]")
if(fexists(out_file))
stdout = file2text(out_file)
fdel(out_file)
if(fexists(err_file))
stderr = file2text(err_file)
fdel(err_file)
if(world.system_type == UNIX)
errorcode = shell("[interpreter] \"[replacetext(command, "\"", "\\\"")]\"")
else
errorcode = shell("[interpreter] \"[command]\"")

shelleo_ids[shelleo_id] = FALSE
else
CRASH("Operating System: [world.system_type] not supported") // If you encounter this error, you are encouraged to update this proc with support for the new operating system
Expand Down
3 changes: 3 additions & 0 deletions code/controllers/configuration/entries/testing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@

///Do not load station
/datum/config_entry/flag/load_no_station

///Enable /proc/shelleo logging.
/datum/config_entry/flag/enable_shelleo_logging
5 changes: 4 additions & 1 deletion config/example/testing.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#Entries here contain flags that are used only on testing.

## Enables bombarda craft.
ENABLE_BOMBARDA_CRAFT
ENABLE_BOMBARDA_CRAFT

## Enables logging for /proc/shelleo. Note: Makes file writing on each call.
ENABLE_SHELLEO_LOGGING

0 comments on commit a24353f

Please sign in to comment.