Fix tryProcess for nonexistent executables on python

This commit is contained in:
2022-09-29 22:35:48 +00:00
parent a1ee467d98
commit 8121ae425c

View File

@@ -671,12 +671,17 @@ class Prelude {
} }
#if python #if python
// on Python, after new Process() is called, writing inputLines to stdin becomes impossible. Use python.lib.subprocess instead // 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), { var p = try {
stdin: -1, // -1 represents PIPE which allows communication Popen.create([command].concat(args), {
stdout: -1, stdin: -1, // -1 represents PIPE which allows communication
stderr: -1, stdout: -1,
cwd: cwd stderr: -1,
}); cwd: cwd
});
} catch (e:Dynamic) {
handleError(Std.string(e));
return null;
}
if (inputLines != null) { if (inputLines != null) {
for (line in inputLines) { for (line in inputLines) {
p.stdin.write(new Bytearray('$line\n', "utf-8")); p.stdin.write(new Bytearray('$line\n', "utf-8"));