Fix tryProcess on C#
This commit is contained in:
@@ -721,28 +721,33 @@ class Prelude {
|
|||||||
#end
|
#end
|
||||||
Sys.setCwd(cwd);
|
Sys.setCwd(cwd);
|
||||||
}
|
}
|
||||||
var p = new Process(command, args);
|
try {
|
||||||
if (inputLines != null) {
|
var p = new Process(command, args);
|
||||||
for (line in inputLines) {
|
if (inputLines != null) {
|
||||||
p.stdin.writeString('$line\n');
|
for (line in inputLines) {
|
||||||
|
p.stdin.writeString('$line\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
var output = if (fullProcess) {
|
||||||
var output = if (fullProcess) {
|
if (p.exitCode() == 0) {
|
||||||
if (p.exitCode() == 0) {
|
p.stdout.readAll().toString().trim();
|
||||||
p.stdout.readAll().toString().trim();
|
} else {
|
||||||
|
handleError('process $command $args failed:\n${p.stdout.readAll().toString().trim() + p.stderr.readAll().toString().trim()}');
|
||||||
|
return "";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
handleError('process $command $args failed:\n${p.stdout.readAll().toString().trim() + p.stderr.readAll().toString().trim()}');
|
p.stdout.readLine().toString().trim();
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
} else {
|
p.kill();
|
||||||
p.stdout.readLine().toString().trim();
|
p.close();
|
||||||
|
if (cwd != null) {
|
||||||
|
Sys.setCwd(lastCwd);
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
} catch (e) {
|
||||||
|
handleError('process $command $args failed: $e');
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
p.kill();
|
|
||||||
p.close();
|
|
||||||
if (cwd != null) {
|
|
||||||
Sys.setCwd(lastCwd);
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
#elseif hxnodejs
|
#elseif hxnodejs
|
||||||
var p = if (inputLines != null) {
|
var p = if (inputLines != null) {
|
||||||
ChildProcess.spawnSync(command, args, {input: inputLines.join("\n"), cwd: cwd});
|
ChildProcess.spawnSync(command, args, {input: inputLines.join("\n"), cwd: cwd});
|
||||||
|
|||||||
Reference in New Issue
Block a user