Skip to content

Commit a9430d9

Browse files
committed
process: fix output truncated
Fixes: #61337
1 parent 01ff6ce commit a9430d9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/internal/process/execution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ function runScriptInContext(name, body, breakFirstLine, print, module, baseUrl,
455455
if (print) {
456456
const { log } = require('internal/console/global');
457457

458-
process.on('exit', () => {
458+
process.once('beforeExit', () => {
459459
log(result);
460460
});
461461
}

test/parallel/test-cli-eval.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ child.exec(...common.escapePOSIXShell`"${process.execPath}" -p "\\-42"`, common.
115115
assert.strictEqual(stderr, '');
116116
}));
117117

118+
// Long output should not be truncated.
119+
child.exec(...common.escapePOSIXShell`"${process.execPath}" -p "'1'.repeat(1e5)"`, common.mustSucceed((stdout, stderr) => {
120+
assert.strictEqual(stdout, `${'1'.repeat(1e5)}\n`);
121+
assert.strictEqual(stderr, '');
122+
}));
123+
118124
child.exec(...common.escapePOSIXShell`"${process.execPath}" --use-strict -p process.execArgv`,
119125
common.mustSucceed((stdout, stderr) => {
120126
assert.strictEqual(

0 commit comments

Comments
 (0)