11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_cicommon.skipIfInspectorDisabled(); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciif (common.isWindows) 61cb0ef41Sopenharmony_ci common.skip('unsupported function on windows'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst assert = require('assert'); 91cb0ef41Sopenharmony_ciconst spawn = require('child_process').spawn; 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_cilet buffer = ''; 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci// Connect to debug agent 141cb0ef41Sopenharmony_ciconst interfacer = spawn(process.execPath, ['inspect', '-p', '655555']); 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciinterfacer.stdout.setEncoding('utf-8'); 171cb0ef41Sopenharmony_ciinterfacer.stderr.setEncoding('utf-8'); 181cb0ef41Sopenharmony_ciconst onData = (data) => { 191cb0ef41Sopenharmony_ci data = (buffer + data).split('\n'); 201cb0ef41Sopenharmony_ci buffer = data.pop(); 211cb0ef41Sopenharmony_ci data.forEach((line) => interfacer.emit('line', line)); 221cb0ef41Sopenharmony_ci}; 231cb0ef41Sopenharmony_ciinterfacer.stdout.on('data', onData); 241cb0ef41Sopenharmony_ciinterfacer.stderr.on('data', onData); 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ciinterfacer.on('line', common.mustCall((line) => { 271cb0ef41Sopenharmony_ci assert.strictEqual(line, 'Target process: 655555 doesn\'t exist.'); 281cb0ef41Sopenharmony_ci})); 29