Skip to content

Commit dfdd911

Browse files
committed
lib: deprecate node --debug at runtime
Fixes: #9789 PR-URL: #10970 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent df14956 commit dfdd911

4 files changed

Lines changed: 35 additions & 5 deletions

File tree

‎doc/api/deprecations.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,15 @@ Type: Documentation-only
511511
The `fs.SyncWriteStream` class was never intended to be a publicly accessible
512512
API.
513513

514+
<aid="DEP0062"></a>
515+
### DEP0062: node --debug
516+
517+
Type: Runtime
518+
519+
`--debug` activates the legacy V8 debugger interface, which has been removed as
520+
of V8 5.8. It is replaced by Inspector which is activated with `--inspect`
521+
instead.
522+
514523
[alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding
515524
[alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size
516525
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size

‎lib/_debug_agent.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
'use strict';
22

3+
process.emitWarning(
4+
'node --debug is deprecated. Please use node --inspect instead.',
5+
'DeprecationWarning',
6+
'DEP0062');
7+
38
constassert=require('assert');
49
constnet=require('net');
510
constutil=require('util');

‎test/parallel/test-debug-port-from-cmdline.js‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22
constcommon=require('../common');
33
constassert=require('assert');
44
constspawn=require('child_process').spawn;
5+
constos=require('os');
56

67
constdebugPort=common.PORT;
78
constargs=['--interactive','--debug-port='+debugPort];
89
constchildOptions={stdio: ['pipe','pipe','pipe','ipc']};
910
constchild=spawn(process.execPath,args,childOptions);
1011

12+
constreDeprecationWarning=newRegExp(
13+
/^\(node:\d+\)\[DEP0062\]DeprecationWarning:/.source+
14+
/node--debugisdeprecated./.source+
15+
/Pleaseusenode--inspectinstead.$/.source
16+
);
17+
1118
child.stdin.write("process.send({ msg: 'childready' });\n");
1219

1320
child.stderr.on('data',function(data){
@@ -37,12 +44,20 @@ function processStderrLine(line) {
3744
}
3845

3946
functionassertOutputLines(){
40-
constexpectedLines=[
41-
'Starting debugger agent.',
42-
'Debugger listening on 127.0.0.1:'+debugPort,
47+
// need a var so can swap the first two lines in following
48+
// eslint-disable-next-line no-var
49+
varexpectedLines=[
50+
/^Startingdebuggeragent.$/,
51+
reDeprecationWarning,
52+
newRegExp(`^Debugger listening on 127.0.0.1:${debugPort}$`)
4353
];
4454

55+
if(os.platform()==='win32'){
56+
expectedLines[1]=expectedLines[0];
57+
expectedLines[0]=reDeprecationWarning;
58+
}
59+
4560
assert.strictEqual(outputLines.length,expectedLines.length);
4661
for(leti=0;i<expectedLines.length;i++)
47-
assert(expectedLines[i].includes(outputLines[i]));
62+
assert(expectedLines[i].test(outputLines[i]));
4863
}

‎test/parallel/test-debug-signal-cluster.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const path = require('path');
88

99
constport=common.PORT;
1010
constserverPath=path.join(common.fixturesDir,'clustered-server','app.js');
11-
constargs=[`--debug-port=${port}`,serverPath];
11+
// cannot use 'Flags: --no-deprecation' since it doesn't effect child
12+
constargs=[`--debug-port=${port}`,'--no-deprecation',serverPath];
1213
constoptions={stdio: ['inherit','inherit','pipe','ipc']};
1314
constchild=spawn(process.execPath,args,options);
1415

0 commit comments

Comments
 (0)