2016-12-03 06:36:02 +08:00
|
|
|
'use strict';
|
|
|
|
|
2017-04-24 22:13:21 +08:00
|
|
|
const common = require('../common');
|
|
|
|
common.skipIfInspectorDisabled();
|
2016-12-03 06:36:02 +08:00
|
|
|
const spawn = require('child_process').spawn;
|
|
|
|
|
2017-04-24 22:13:21 +08:00
|
|
|
const proc = spawn(process.execPath, ['inspect', 'foo']);
|
2016-12-03 06:36:02 +08:00
|
|
|
proc.stdout.setEncoding('utf8');
|
|
|
|
|
2018-07-16 01:52:36 +08:00
|
|
|
let needToSendExit = true;
|
2016-12-17 16:01:47 +08:00
|
|
|
let output = '';
|
|
|
|
proc.stdout.on('data', (data) => {
|
|
|
|
output += data;
|
2018-07-16 01:52:36 +08:00
|
|
|
if (output.includes('debug> ') && needToSendExit) {
|
2017-09-02 08:30:10 +08:00
|
|
|
proc.stdin.write('.exit\n');
|
2018-07-16 01:52:36 +08:00
|
|
|
needToSendExit = false;
|
|
|
|
}
|
2016-12-17 16:01:47 +08:00
|
|
|
});
|