TheThing
8fad1b45b1
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
25 lines
544 B
JavaScript
25 lines
544 B
JavaScript
import { fork } from 'child_process'
|
|
import t from '../../lib/eltro.mjs'
|
|
import assert from '../../lib/assert.mjs'
|
|
import kill from '../../lib/kill.mjs'
|
|
|
|
t.describe('kill', function() {
|
|
let worker
|
|
|
|
t.afterEach(function() {
|
|
if (worker?.pid && !worker.killed) {
|
|
worker.kill()
|
|
}
|
|
})
|
|
|
|
t.test('should kill process correctly', function(done) {
|
|
worker = fork('./test/')
|
|
assert.ok(worker.pid)
|
|
|
|
worker.on('exit', done.finish(function(code, signal) {
|
|
assert.ok(code || signal)
|
|
}))
|
|
|
|
kill(worker.pid)
|
|
})
|
|
})
|