From d13dd67fe7ea30dc89e9f9ef1c0f72ee59b9a0a4 Mon Sep 17 00:00:00 2001 From: dpomier Date: Wed, 29 Jan 2020 11:40:27 +0100 Subject: [PATCH 1/3] allow running processes with commands that are not executables --- src/hxp/System.hx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hxp/System.hx b/src/hxp/System.hx index 7aed146..afd233f 100644 --- a/src/hxp/System.hx +++ b/src/hxp/System.hx @@ -1076,7 +1076,7 @@ class System } public static function runProcess(path:String, command:String, args:Array, waitForOutput:Bool = true, safeExecute:Bool = true, - ignoreErrors:Bool = false, print:Bool = false, returnErrorValue:Bool = false):String + ignoreErrors:Bool = false, print:Bool = false, returnErrorValue:Bool = false, allowNonExecutables = false):String { if (print) { @@ -1113,7 +1113,7 @@ class System Log.error("The specified target path \"" + path + "\" does not exist"); } - return _runProcess(path, command, args, waitForOutput, safeExecute, ignoreErrors, returnErrorValue); + return _runProcess(path, command, args, waitForOutput, safeExecute, ignoreErrors, returnErrorValue, allowNonExecutables); } catch (e:Dynamic) { @@ -1127,12 +1127,12 @@ class System } else { - return _runProcess(path, command, args, waitForOutput, safeExecute, ignoreErrors, returnErrorValue); + return _runProcess(path, command, args, waitForOutput, safeExecute, ignoreErrors, returnErrorValue, allowNonExecutables); } } private static function _runProcess(path:String, command:String, args:Array, waitForOutput:Bool, safeExecute:Bool, ignoreErrors:Bool, - returnErrorValue:Bool):String + returnErrorValue:Bool, allowNonExecutables:Bool):String { var oldPath:String = ""; @@ -1168,7 +1168,7 @@ class System if (!dryRun) { - var process = new Process(command, args); + var process = allowNonExecutables ? new Process('$command ${args.join(" ")}', null) : new Process(command, args); var buffer = new BytesOutput(); if (waitForOutput) From db42e12e7e8d73860b946d29f40d55be314bbd7d Mon Sep 17 00:00:00 2001 From: dpomier Date: Wed, 29 Jan 2020 11:41:12 +0100 Subject: [PATCH 2/3] fix running 'haxelib path lib' when using lix --- src/hxp/Haxelib.hx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hxp/Haxelib.hx b/src/hxp/Haxelib.hx index 0db5ddc..8010eb3 100644 --- a/src/hxp/Haxelib.hx +++ b/src/hxp/Haxelib.hx @@ -128,7 +128,7 @@ class Haxelib var cacheDryRun = System.dryRun; System.dryRun = false; - output = Haxelib.runProcess(workingDirectory, ["path", name], true, true, true); + output = Haxelib.runProcess(workingDirectory, ["path", name], true, true, true, false, false, true); if (output == null) output = ""; System.dryRun = cacheDryRun; @@ -432,7 +432,7 @@ class Haxelib } public static function runProcess(path:String, args:Array, waitForOutput:Bool = true, safeExecute:Bool = true, ignoreErrors:Bool = false, - print:Bool = false, returnErrorValue:Bool = false):String + print:Bool = false, returnErrorValue:Bool = false, allowNonExecutables:Bool = false):String { if (pathOverrides.exists("haxelib")) { @@ -443,7 +443,7 @@ class Haxelib Log.error("Cannot find haxelib script: " + script); } - return System.runProcess(path, "neko", [script].concat(args), waitForOutput, safeExecute, ignoreErrors, print, returnErrorValue); + return System.runProcess(path, "neko", [script].concat(args), waitForOutput, safeExecute, ignoreErrors, print, returnErrorValue, allowNonExecutables); } else { @@ -456,7 +456,7 @@ class Haxelib // } - return System.runProcess(path, command, args, waitForOutput, safeExecute, ignoreErrors, print, returnErrorValue); + return System.runProcess(path, command, args, waitForOutput, safeExecute, ignoreErrors, print, returnErrorValue, allowNonExecutables); } } From 37e9b151ef61d632c1380471448a12ccd9aa7063 Mon Sep 17 00:00:00 2001 From: dpomier Date: Wed, 29 Jan 2020 12:21:26 +0100 Subject: [PATCH 3/3] minor change --- src/hxp/System.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hxp/System.hx b/src/hxp/System.hx index afd233f..526c559 100644 --- a/src/hxp/System.hx +++ b/src/hxp/System.hx @@ -1168,7 +1168,7 @@ class System if (!dryRun) { - var process = allowNonExecutables ? new Process('$command ${args.join(" ")}', null) : new Process(command, args); + var process = allowNonExecutables ? new Process(command + " " + args.join(" ")) : new Process(command, args); var buffer = new BytesOutput(); if (waitForOutput)