Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b861451

Browse filesBrowse files
mohd-akramaduh95
authored andcommitted
process: do not truncate long strings in --print
Fixes: #61337 PR-URL: #61497 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent be644e2 commit b861451
Copy full SHA for b861451

2 files changed

+12-2Lines changed: 12 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/process/execution.js‎

Copy file name to clipboardExpand all lines: lib/internal/process/execution.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,12 @@ function runScriptInContext(name, body, breakFirstLine, print, module, baseUrl,
455455
if (print) {
456456
const { log } = require('internal/console/global');
457457

458-
process.on('exit', () => {
459-
log(result);
458+
const printResult = () => log(result);
459+
460+
process.on('exit', printResult);
461+
process.once('beforeExit', () => {
462+
printResult();
463+
process.off('exit', printResult);
460464
});
461465
}
462466
if (origModule !== undefined)
Collapse file

‎test/parallel/test-cli-eval.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cli-eval.js
+6Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.