Skip to content

Commit

Permalink
fix: use spawn to stream larger output rather than exec which buffers it
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-fields committed Aug 4, 2022
1 parent 63b15da commit e75d568
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,8 @@ function runCmd(attempt) {
done = false;
(0, core_1.debug)("Running command ".concat(COMMAND, " on ").concat(OS, " using shell ").concat(executable));
child = attempt > 1 && NEW_COMMAND_ON_RETRY
? (0, child_process_1.exec)(NEW_COMMAND_ON_RETRY, { shell: executable })
: (0, child_process_1.exec)(COMMAND, { shell: executable });
? (0, child_process_1.spawn)(NEW_COMMAND_ON_RETRY, { shell: executable })
: (0, child_process_1.spawn)(COMMAND, { shell: executable });
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on('data', function (data) {
process.stdout.write(data);
});
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getInput, error, warning, info, debug, setOutput } from '@actions/core';
import { exec, execSync } from 'child_process';
import { execSync, spawn } from 'child_process';
import ms from 'milliseconds';
import kill from 'tree-kill';

Expand Down Expand Up @@ -137,8 +137,8 @@ async function runCmd(attempt: number) {
debug(`Running command ${COMMAND} on ${OS} using shell ${executable}`);
const child =
attempt > 1 && NEW_COMMAND_ON_RETRY
? exec(NEW_COMMAND_ON_RETRY, { shell: executable })
: exec(COMMAND, { shell: executable });
? spawn(NEW_COMMAND_ON_RETRY, { shell: executable })
: spawn(COMMAND, { shell: executable });

child.stdout?.on('data', (data) => {
process.stdout.write(data);
Expand Down

0 comments on commit e75d568

Please sign in to comment.