Skip to content

Commit e16dd6d

Browse files
BridgeARtargos
authored andcommitted
repl: refactor ERR_SCRIPT_EXECUTION_INTERRUPTED stack handling
The stack was removed later on instead of never being attached in the first place. PR-URL: #22436 Refs: #20253 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent b1ffda6 commit e16dd6d

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

lib/repl.js

+5-11
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,6 @@ function REPLServer(prompt,
345345
} catch (e) {
346346
err = e;
347347

348-
if (err && err.code === 'ERR_SCRIPT_EXECUTION_INTERRUPTED') {
349-
// The stack trace for this case is not very useful anyway.
350-
Object.defineProperty(err, 'stack', { value: '' });
351-
}
352-
353348
if (process.domain) {
354349
debug('not recoverable, send to domain');
355350
process.domain.emit('error', err);
@@ -365,7 +360,11 @@ function REPLServer(prompt,
365360
if (self.breakEvalOnSigint) {
366361
const interrupt = new Promise((resolve, reject) => {
367362
sigintListener = () => {
368-
reject(new ERR_SCRIPT_EXECUTION_INTERRUPTED());
363+
const tmp = Error.stackTraceLimit;
364+
Error.stackTraceLimit = 0;
365+
const err = new ERR_SCRIPT_EXECUTION_INTERRUPTED();
366+
Error.stackTraceLimit = tmp;
367+
reject(err);
369368
};
370369
prioritizedSigintQueue.add(sigintListener);
371370
});
@@ -384,11 +383,6 @@ function REPLServer(prompt,
384383
// Remove prioritized SIGINT listener if it was not called.
385384
prioritizedSigintQueue.delete(sigintListener);
386385

387-
if (err.code === 'ERR_SCRIPT_EXECUTION_INTERRUPTED') {
388-
// The stack trace for this case is not very useful anyway.
389-
Object.defineProperty(err, 'stack', { value: '' });
390-
}
391-
392386
unpause();
393387
if (err && process.domain) {
394388
debug('not recoverable, send to domain');

0 commit comments

Comments
 (0)