fix(doc): update example for sub processes
@@ -70,11 +70,13 @@ const p = Deno.run({
const { code } = await p.status();
-if (code === 0) {
+// Reading the outputs closes their pipes
const rawOutput = await p.output();
+const rawError = await p.stderrOutput();
+
+if (code === 0) {
await Deno.stdout.write(rawOutput);
} else {
- const rawError = await p.stderrOutput();
const errorString = new TextDecoder().decode(rawError);
console.log(errorString);
}
