Parcourir la source

Lua : use shell escape helper for Sys command

Justin Donaldson il y a 9 ans
Parent
commit
7e5371e373
1 fichiers modifiés avec 2 ajouts et 11 suppressions
  1. 2 11
      std/lua/_std/Sys.hx

+ 2 - 11
std/lua/_std/Sys.hx

@@ -29,6 +29,7 @@ import lua.Os;
 import lua.lib.lfs.Lfs;
 import lua.FileHandle;
 import lua.Io;
+import lua.Boot;
 import sys.io.FileInput;
 import sys.io.FileOutput;
 
@@ -44,17 +45,7 @@ class Sys {
 		return lua.Lib.tableToArray(lua.Lua.arg);
 	}
 	public static function command( cmd : String, ?args : Array<String> ) : Int  {
-		if (args != null) {
-			switch (systemName()) {
-				case "Windows":
-					cmd = [
-						for (a in [StringTools.replace(cmd, "/", "\\")].concat(args))
-						StringTools.quoteWinArg(a, true)
-					].join(" ");
-				case _:
-					cmd = [cmd].concat(args).map(StringTools.quoteUnixArg).join(" ");
-			}
-		}
+		cmd = Boot.shellEscapeCmd(cmd, args);
 		return cast Table.pack(Os.execute(cmd))[3];
 	}