diff --git a/lib/repl.js b/lib/repl.js index ad1a4bab913fa9..46f81a02f0c5d5 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -345,11 +345,6 @@ function REPLServer(prompt, } catch (e) { err = e; - if (err && err.code === 'ERR_SCRIPT_EXECUTION_INTERRUPTED') { - // The stack trace for this case is not very useful anyway. - Object.defineProperty(err, 'stack', { value: '' }); - } - if (process.domain) { debug('not recoverable, send to domain'); process.domain.emit('error', err); @@ -365,7 +360,11 @@ function REPLServer(prompt, if (self.breakEvalOnSigint) { const interrupt = new Promise((resolve, reject) => { sigintListener = () => { - reject(new ERR_SCRIPT_EXECUTION_INTERRUPTED()); + const tmp = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + const err = new ERR_SCRIPT_EXECUTION_INTERRUPTED(); + Error.stackTraceLimit = tmp; + reject(err); }; prioritizedSigintQueue.add(sigintListener); }); @@ -384,11 +383,6 @@ function REPLServer(prompt, // Remove prioritized SIGINT listener if it was not called. prioritizedSigintQueue.delete(sigintListener); - if (err.code === 'ERR_SCRIPT_EXECUTION_INTERRUPTED') { - // The stack trace for this case is not very useful anyway. - Object.defineProperty(err, 'stack', { value: '' }); - } - unpause(); if (err && process.domain) { debug('not recoverable, send to domain');