Skip to content

Commit

Permalink
debugger: call this.resume() after this.run()
Browse files Browse the repository at this point in the history
When the debugger has started we need to call `this.resume` otherwise,
the prompt won't appear.

Fixes: nodejs#9854
PR-URL: nodejs#10099
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
lance authored and Jonathan Darling committed Dec 8, 2016
1 parent 7ce46c8 commit 81ac97d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ function Interface(stdin, stdout, args) {
// Run script automatically
this.pause();

setImmediate(() => { this.run(); });
setImmediate(() => { this.run(() => this.resume()); });
}


Expand Down
13 changes: 13 additions & 0 deletions test/parallel/test-debug-prompt.js
Original file line number Diff line number Diff line change
@@ -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();
}));

0 comments on commit 81ac97d

Please sign in to comment.