diff --git a/lib/_debugger.js b/lib/_debugger.js index 2ccbc5e6607379..32820803071c1c 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -835,7 +835,7 @@ function Interface(stdin, stdout, args) { // Run script automatically this.pause(); - setImmediate(() => { this.run(); }); + setImmediate(() => { this.run(() => this.resume()); }); } diff --git a/test/parallel/test-debug-prompt.js b/test/parallel/test-debug-prompt.js new file mode 100644 index 00000000000000..fdc3b4c27f4d45 --- /dev/null +++ b/test/parallel/test-debug-prompt.js @@ -0,0 +1,13 @@ +'use strict'; + +const assert = require('assert'); +const common = require('../common'); +const spawn = require('child_process').spawn; + +const proc = spawn(process.execPath, ['debug', 'foo']); +proc.stdout.setEncoding('utf8'); + +proc.stdout.once('data', common.mustCall((data) => { + assert.strictEqual(data, 'debug> '); + proc.kill(); +}));