11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_cicommon.skipIfInspectorDisabled(); 51cb0ef41Sopenharmony_ciconst spawn = require('child_process').spawn; 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst proc = spawn(process.execPath, ['inspect', 'foo']); 81cb0ef41Sopenharmony_ciproc.stdout.setEncoding('utf8'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cilet needToSendExit = true; 111cb0ef41Sopenharmony_cilet output = ''; 121cb0ef41Sopenharmony_ciproc.stdout.on('data', (data) => { 131cb0ef41Sopenharmony_ci output += data; 141cb0ef41Sopenharmony_ci if (output.includes('debug> ') && needToSendExit) { 151cb0ef41Sopenharmony_ci proc.stdin.write('.exit\n'); 161cb0ef41Sopenharmony_ci needToSendExit = false; 171cb0ef41Sopenharmony_ci } 181cb0ef41Sopenharmony_ci}); 19