1'use strict'; 2 3const common = require('../common'); 4common.skipIfInspectorDisabled(); 5const spawn = require('child_process').spawn; 6 7const proc = spawn(process.execPath, ['inspect', 'foo']); 8proc.stdout.setEncoding('utf8'); 9 10let needToSendExit = true; 11let output = ''; 12proc.stdout.on('data', (data) => { 13 output += data; 14 if (output.includes('debug> ') && needToSendExit) { 15 proc.stdin.write('.exit\n'); 16 needToSendExit = false; 17 } 18}); 19