From 8121ae425c62c192653490b999358cda71c8394e Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Thu, 29 Sep 2022 22:35:48 +0000 Subject: [PATCH] Fix tryProcess for nonexistent executables on python --- kiss/src/kiss/Prelude.hx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/kiss/src/kiss/Prelude.hx b/kiss/src/kiss/Prelude.hx index e4bcd679..d4b709c5 100644 --- a/kiss/src/kiss/Prelude.hx +++ b/kiss/src/kiss/Prelude.hx @@ -671,12 +671,17 @@ class Prelude { } #if python // on Python, after new Process() is called, writing inputLines to stdin becomes impossible. Use python.lib.subprocess instead - var p = Popen.create([command].concat(args), { - stdin: -1, // -1 represents PIPE which allows communication - stdout: -1, - stderr: -1, - cwd: cwd - }); + var p = try { + Popen.create([command].concat(args), { + stdin: -1, // -1 represents PIPE which allows communication + stdout: -1, + stderr: -1, + cwd: cwd + }); + } catch (e:Dynamic) { + handleError(Std.string(e)); + return null; + } if (inputLines != null) { for (line in inputLines) { p.stdin.write(new Bytearray('$line\n', "utf-8"));