mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
process: do not truncate long strings in --print
Fixes: https://github.com/nodejs/node/issues/61337 PR-URL: https://github.com/nodejs/node/pull/61497 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
1 parent
dccfee1cd0
commit
27fb167f77
2 files changed
+12
-2
No files matched your search
@@ -450,8 +450,12 @@ function runScriptInContext(name, body, breakFirstLine, print, module, baseUrl,
|
||||
if (print) {
|
||||
const { log } = require('internal/console/global');
|
||||
|
||||
process.on('exit', () => {
|
||||
log(result);
|
||||
const printResult = () => log(result);
|
||||
|
||||
process.on('exit', printResult);
|
||||
process.once('beforeExit', () => {
|
||||
printResult();
|
||||
process.off('exit', printResult);
|
||||
});
|
||||
}
|
||||
if (origModule !== undefined)
|
||||
|
||||
@@ -115,6 +115,12 @@ child.exec(...common.escapePOSIXShell`"${process.execPath}" -p "\\-42"`, common.
|
||||
assert.strictEqual(stderr, '');
|
||||
}));
|
||||
|
||||
// Long output should not be truncated.
|
||||
child.exec(...common.escapePOSIXShell`"${process.execPath}" -p "'1'.repeat(1e5)"`, common.mustSucceed((stdout, stderr) => {
|
||||
assert.strictEqual(stdout, `${'1'.repeat(1e5)}\n`);
|
||||
assert.strictEqual(stderr, '');
|
||||
}));
|
||||
|
||||
child.exec(...common.escapePOSIXShell`"${process.execPath}" --use-strict -p process.execArgv`,
|
||||
common.mustSucceed((stdout, stderr) => {
|
||||
assert.strictEqual(
|
||||
|
||||
Reference in new issue
Block a user