mirror of
https://github.com/denoland/deno.git
synced 2024-11-29 16:30:56 -05:00
fix(doc): update example for sub processes (#9798)
This commit is contained in:
parent
506b321d47
commit
bd961c3bc3
1 changed files with 4 additions and 2 deletions
|
@ -70,11 +70,13 @@ const p = Deno.run({
|
||||||
|
|
||||||
const { code } = await p.status();
|
const { code } = await p.status();
|
||||||
|
|
||||||
if (code === 0) {
|
// Reading the outputs closes their pipes
|
||||||
const rawOutput = await p.output();
|
const rawOutput = await p.output();
|
||||||
|
const rawError = await p.stderrOutput();
|
||||||
|
|
||||||
|
if (code === 0) {
|
||||||
await Deno.stdout.write(rawOutput);
|
await Deno.stdout.write(rawOutput);
|
||||||
} else {
|
} else {
|
||||||
const rawError = await p.stderrOutput();
|
|
||||||
const errorString = new TextDecoder().decode(rawError);
|
const errorString = new TextDecoder().decode(rawError);
|
||||||
console.log(errorString);
|
console.log(errorString);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue