Add Process.output (#1235)

This commit is contained in:
DanSnow 2018-12-01 02:44:05 +08:00 committed by Ryan Dahl
parent e749b37b7c
commit d43a4be0d2
2 changed files with 30 additions and 2 deletions

View file

@ -176,3 +176,14 @@ testPerm({ run: true }, async function runStderrPiped() {
assertEqual(status.signal, undefined);
p.close();
});
testPerm({ run: true }, async function runOutput() {
const p = run({
args: ["python", "-c", "import sys; sys.stdout.write('hello')"],
stdout: "piped"
});
const output = await p.output();
const s = new TextDecoder().decode(output);
assertEqual(s, "hello");
p.close();
});