From 750b59afc3288362126d21ff230931502e005545 Mon Sep 17 00:00:00 2001 From: ehmicky Date: Sun, 12 May 2019 15:13:31 +0200 Subject: [PATCH 1/2] Improve README example --- readme.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 8837499a84..db58eaeb27 100644 --- a/readme.md +++ b/readme.md @@ -327,14 +327,13 @@ Let's say you want to show the output of a child process in real-time while also ```js const execa = require('execa'); -const getStream = require('get-stream'); -const stream = execa('echo', ['foo']).stdout; +const subprocess = execa('echo', ['foo']); -stream.pipe(process.stdout); +subprocess.stdout.pipe(process.stdout); -getStream(stream).then(value => { - console.log('child output:', value); +subprocess.then(({ stdout }) => { + console.log('child output:', stdout); }); ``` From f2643d06e37a859a71805ccd80a8b187a9bbd2f6 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sun, 12 May 2019 21:20:47 +0700 Subject: [PATCH 2/2] Update readme.md --- readme.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index db58eaeb27..9481c13703 100644 --- a/readme.md +++ b/readme.md @@ -332,9 +332,10 @@ const subprocess = execa('echo', ['foo']); subprocess.stdout.pipe(process.stdout); -subprocess.then(({ stdout }) => { +(async () => { + const {stdout} = await subprocess; console.log('child output:', stdout); -}); +})(); ```