Skip to content

Commit de16234

Browse files
committed
fix: stream command output to stdout and stderr
1 parent 0fee76f commit de16234

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async function analyzeCommits(pluginConfig, context) {
1818
verifyConfig(pluginConfig);
1919

2020
const stdout = await execScript(pluginConfig, context);
21-
return stdout.trim() ? stdout : undefined;
21+
return stdout || undefined;
2222
}
2323

2424
async function verifyRelease(pluginConfig, context) {
@@ -49,7 +49,7 @@ async function publish(pluginConfig, context) {
4949
const stdout = await execScript(pluginConfig, context);
5050

5151
try {
52-
return stdout.trim() ? parseJson(stdout) : undefined;
52+
return stdout ? parseJson(stdout) : undefined;
5353
} catch (err) {
5454
debug(stdout);
5555
debug(err);

lib/exec-script.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ module.exports = async ({cmd, ...config}, {cwd, env, stdout, stderr, logger, ...
66

77
logger.log('Call script %s', script);
88

9-
const {stdout: cmdStdout, stderr: cmdStderr} = await execa.shell(script, {cwd, env});
10-
stdout.write(cmdStdout);
11-
stderr.write(cmdStderr);
9+
const result = execa.shell(script, {cwd, env});
1210

13-
return cmdStdout.trim();
11+
result.stdout.pipe(
12+
stdout,
13+
{end: false}
14+
);
15+
result.stderr.pipe(
16+
stderr,
17+
{end: false}
18+
);
19+
20+
return (await result).stdout.trim();
1421
};

0 commit comments

Comments
 (0)