mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
a85ce885bd
The `node debug` command has been deprecated for a while now. There's really no good reason to keep it around. Move to end of life. PR-URL: https://github.com/nodejs/node/pull/33648 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
29 lines
788 B
JavaScript
29 lines
788 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
|
|
if (common.isWindows)
|
|
common.skip('unsupported function on windows');
|
|
|
|
const assert = require('assert');
|
|
const spawn = require('child_process').spawn;
|
|
|
|
let buffer = '';
|
|
|
|
// Connect to debug agent
|
|
const interfacer = spawn(process.execPath, ['inspect', '-p', '655555']);
|
|
|
|
interfacer.stdout.setEncoding('utf-8');
|
|
interfacer.stderr.setEncoding('utf-8');
|
|
const onData = (data) => {
|
|
data = (buffer + data).split('\n');
|
|
buffer = data.pop();
|
|
data.forEach((line) => interfacer.emit('line', line));
|
|
};
|
|
interfacer.stdout.on('data', onData);
|
|
interfacer.stderr.on('data', onData);
|
|
|
|
interfacer.on('line', common.mustCall((line) => {
|
|
assert.strictEqual(line, 'Target process: 655555 doesn\'t exist.');
|
|
}));
|