diff options
author | Makuza Mugabo Verite <53856673+makuzaverite@users.noreply.github.com> | 2021-03-16 13:05:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 07:05:04 -0400 |
commit | bd961c3bc305e90e760394d2f424c5360a67543b (patch) | |
tree | 97652b05befc68166869d75ed87d4eb34e22f920 /docs/examples/subprocess.md | |
parent | 506b321d472005d0cf916823dfa8ea37fa0b064a (diff) |
fix(doc): update example for sub processes (#9798)
Diffstat (limited to 'docs/examples/subprocess.md')
-rw-r--r-- | docs/examples/subprocess.md | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/examples/subprocess.md b/docs/examples/subprocess.md index 3f1297cc0..e5956e1af 100644 --- a/docs/examples/subprocess.md +++ b/docs/examples/subprocess.md @@ -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); } |