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