From bde31f75a78a73574ca8a80c8d20f6856da1ce85 Mon Sep 17 00:00:00 2001 From: Lance Ball Date: Fri, 2 Dec 2016 17:36:02 -0500 Subject: [PATCH] debugger: call `this.resume()` after `this.run()` When the debugger has started we need to call `this.resume` otherwise, the prompt won't appear. Fixes: https://github.com/nodejs/node/issues/9854 PR-URL: https://github.com/nodejs/node/pull/10099 Reviewed-By: Colin Ihrig Reviewed-By: Ben Noordhuis Reviewed-By: Rich Trott --- lib/_debugger.js | 2 +- test/parallel/test-debug-prompt.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-debug-prompt.js 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(); +}));