Skip to content

Commit

Permalink
system agnostic shelleo
Browse files Browse the repository at this point in the history
  • Loading branch information
CASEYGUNGEON committed Jul 18, 2024
1 parent 870f78d commit fe62047
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion code/__HELPERS/shell.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
var/err_file = ""
var/static/list/interpreters = list("[MS_WINDOWS]" = "cmd /c", "[UNIX]" = "sh -c")
var/interpreter = interpreters["[world.system_type]"]
var/static/list/arg_enclosers = list("[MS_WINDOWS]" = "\"", "[UNIX]" = "'")
var/closer = arg_enclosers["[world.system_type]"]
command = closer + command + closer
if(interpreter)
for(var/seo_id in shelleo_ids)
if(!shelleo_ids[seo_id])
Expand All @@ -25,7 +28,7 @@
shelleo_ids[shelleo_id] = TRUE
out_file = "[SHELLEO_NAME][shelleo_id][SHELLEO_OUT]"
err_file = "[SHELLEO_NAME][shelleo_id][SHELLEO_ERR]"
errorcode = shell("[interpreter] \"[command]\" > [out_file] 2> [err_file]")
errorcode = shell("[interpreter] [command] > [out_file] 2> [err_file]")
if(fexists(out_file))
stdout = file2text(out_file)
fdel(out_file)
Expand Down

0 comments on commit fe62047

Please sign in to comment.