Skip to content

Commit 65569d7

Browse files
committed
feat: Stream output
Pipe output from execa to stdout and stderr. Closes: #9
1 parent d1527cd commit 65569d7

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

cli.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ if (Object.keys(cli.flags).map(key => typeof cli.flags[key]).some(type => type =
7676
}
7777

7878
errorNotifier(cli.input[0], cli.flags)
79-
.then(result => {
80-
console.log(result.stdout || result.stderr);
81-
})
8279
.catch(error => {
83-
console.error(error.stdout || error.stderr);
8480
process.exit(error.code);
8581
});

lib/error-notifier.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ module.exports = (command, opts) => {
77
opts = opts || {};
88

99
return new Promise((resolve, reject) => {
10-
execa.shell(command, {env: {FORCE_COLOR: true}})
11-
.then(result => resolve(result))
10+
const execaPending = execa.shell(command, {env: {FORCE_COLOR: true}});
11+
execaPending.stdout.pipe(process.stdout);
12+
execaPending.stderr.pipe(process.stderr);
13+
return execaPending.then(result => resolve(result))
1214
.catch(error => notifier.notify(notifierOptions(opts), () => reject(error)));
1315
});
1416
};

0 commit comments

Comments
 (0)