Skip to content

Commit

Permalink
fix(doc): update example for sub processes (denoland#9798)
Browse files Browse the repository at this point in the history
  • Loading branch information
veritem authored Mar 16, 2021
1 parent 506b321 commit bd961c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/examples/subprocess.md
Original file line number Diff line number Diff line change
@@ -70,11 +70,13 @@ const p = Deno.run({

const { code } = await p.status();

// Reading the outputs closes their pipes
const rawOutput = await p.output();
const rawError = await p.stderrOutput();

if (code === 0) {
const rawOutput = await p.output();
await Deno.stdout.write(rawOutput);
} else {
const rawError = await p.stderrOutput();
const errorString = new TextDecoder().decode(rawError);
console.log(errorString);
}

0 comments on commit bd961c3

Please sign in to comment.