Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src, lib: deprecate old debug-agent and CLI debugger #10276

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const assert = require('assert');
const spawn = require('child_process').spawn;
const Buffer = require('buffer').Buffer;

exports.start = function(argv, stdin, stdout) {
exports.start = function start(argv, stdin, stdout) {
argv || (argv = process.argv.slice(2));

if (argv.length < 1) {
Expand All @@ -27,6 +27,7 @@ exports.start = function(argv, stdin, stdout) {
stdout = stdout || process.stdout;

const args = [`--debug-brk=${exports.port}`].concat(argv);
console.error('`node debug` is deprecated, use `node inspect` instead.\n');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, this should be updated to use process.emitWarning() and DeprecationWarning instead.

const interface_ = new Interface(stdin, stdout, args);

stdin.resume();
Expand Down
1 change: 0 additions & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3460,7 +3460,6 @@ static void PrintHelp() {
// XXX: If you add an option here, please also add it to doc/node.1 and
// doc/api/cli.md
printf("Usage: node [options] [ -e script | script.js ] [arguments] \n"
" node debug script.js [arguments] \n"
"\n"
"Options:\n"
" -v, --version print Node.js version\n"
Expand Down
3 changes: 3 additions & 0 deletions src/node_debug_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ bool DebugOptions::ParseOption(const std::string& option) {

if (option_name == "--debug") {
debugger_enabled_ = true;
fprintf(stderr,
"--debug is deprecated and will be removed in "
"a future version. Please use --inspect instead.\n\n");
} else if (option_name == "--debug-brk") {
debugger_enabled_ = true;
wait_connect_ = true;
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-debugger-pid.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ var onData = function(data) {
});
};
interfacer.stdout.on('data', onData);
interfacer.stderr.on('data', onData);

var lineCount = 0;
interfacer.on('line', function(line) {
Expand Down
8 changes: 7 additions & 1 deletion test/parallel/test-debugger-util-regression.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ const fixture = path.join(
'debugger-util-regression-fixture.js'
);

const deprecationWarning = [
'`node debug` is deprecated, ',
'use `node inspect` instead.\n\n'
].join('');

const args = [
'debug',
`--port=${common.PORT}`,
Expand Down Expand Up @@ -49,5 +54,6 @@ process.on('exit', (code) => {
assert.strictEqual(code, 0, 'the program should exit cleanly');
assert.strictEqual(stdout.includes('{ a: \'b\' }'), true,
'the debugger should print the result of util.inspect');
assert.strictEqual(stderr, '', 'stderr should be empty');
assert.strictEqual(stderr, deprecationWarning,
'stderr should print deprecation warning');
});