diff --git a/test/kill/kill.test.mjs b/test/kill/kill.test.mjs index 2cbebe1..1dc6fba 100644 --- a/test/kill/kill.test.mjs +++ b/test/kill/kill.test.mjs @@ -24,17 +24,20 @@ t.describe('kill', function() { }) t.test('should succeed in killing tree', async function() { + console.log() worker = spawn('node', ['./test/kill/runner.mjs']) assert.ok(worker.pid) // Give it some time to start await new Promise(res => { worker.stdout.on('data', function(data) { - if (data.toString().indexOf('primary') >= 0) res() + process.stdout.write(data) + if (data.toString().indexOf('secondary') >= 0) res() }) }) return kill(worker.pid).then(function(pids) { + console.log(pids) assert.strictEqual(pids.size, 2) }) }) diff --git a/test/kill/runner.mjs b/test/kill/runner.mjs index 2e2881a..0b4110e 100644 --- a/test/kill/runner.mjs +++ b/test/kill/runner.mjs @@ -1,11 +1,11 @@ import { spawn } from 'child_process' +console.log('primary', process.pid) + let secondary = spawn('node', ['./test/kill/second_runner.mjs']) secondary.stdout.on('data', function(data) { process.stdout.write(data) }) -console.log('primary') - -setInterval(function() { console.log('primary') }, 100) \ No newline at end of file +setInterval(function() { console.log('primary', process.pid) }, 100) \ No newline at end of file diff --git a/test/kill/second_runner.mjs b/test/kill/second_runner.mjs index 9670a73..7a30e22 100644 --- a/test/kill/second_runner.mjs +++ b/test/kill/second_runner.mjs @@ -1,2 +1,2 @@ -console.log('secondary') -setInterval(function() { console.log('secondary') }, 100) \ No newline at end of file +console.log('secondary', process.pid) +setInterval(function() { console.log('secondary', process.pid) }, 100) \ No newline at end of file