Ver Fonte

fixed invalid sys_command

Nicolas Cannasse há 9 anos atrás
pai
commit
8fd21e70e8
1 ficheiros alterados com 4 adições e 6 exclusões
  1. 4 6
      std/hl/_std/Sys.hx

+ 4 - 6
std/hl/_std/Sys.hx

@@ -115,9 +115,8 @@ class Sys {
 
 	public static function command( cmd : String, ?args : Array<String> ) : Int {
 		var code = 0;
-		var ok;
 		if (args == null) {
-			ok = sys_command(getPath(cmd), code);
+			code = sys_command(getPath(cmd));
 		} else {
 			switch (systemName()) {
 				case "Windows":
@@ -125,13 +124,12 @@ class Sys {
 						for (a in [StringTools.replace(cmd, "/", "\\")].concat(args))
 						StringTools.quoteWinArg(a, true)
 					].join(" ");
-					ok = sys_command(getPath(cmd), code);
+					code = sys_command(getPath(cmd));
 				case _:
 					cmd = [cmd].concat(args).map(StringTools.quoteUnixArg).join(" ");
-					ok = sys_command(getPath(cmd), code);
+					code = sys_command(getPath(cmd));
 			}
 		}
-		if( !ok ) throw new SysError("Failed to run command " + cmd);
 		return code;
 	}
 
@@ -161,7 +159,7 @@ class Sys {
 	@:hlNative("std", "sys_set_time_locale") static function set_time_locale( loc : hl.types.Bytes ) : Bool { return true; }
 	@:hlNative("std", "sys_get_cwd") static function get_cwd() : hl.types.Bytes { return null; }
 	@:hlNative("std", "sys_set_cwd") static function set_cwd( path : hl.types.Bytes ) : Bool { return true; }
-	@:hlNative("std", "sys_command") static function sys_command( cmd : hl.types.Bytes, code : hl.types.Ref<Int> ) : Bool { return false; }
+	@:hlNative("std", "sys_command") static function sys_command( cmd : hl.types.Bytes ) : Int { return 0; }
 	@:hlNative("std", "sys_exe_path") static function sys_exe_path() : hl.types.Bytes { return null; }
 	@:hlNative("std", "sys_string") static function sys_string() : hl.types.Bytes { return null; }