free zombie processes from proctable

This commit is contained in:
Thomas Hobson 2021-04-26 11:22:28 +12:00
parent 18a44bf146
commit dd31873700
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
1 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,7 @@ const config = require('./config');
const globals = require('./globals');
const fs = require('fs/promises');
const ps_list = require('ps-list');
const wait_pid = require('waitpid');
const job_states = {
READY: Symbol('Ready to be primed'),
@ -190,7 +191,10 @@ class Job {
await Promise.all(
processes.map(
proc => process.kill(proc.pid, 'SIGKILL')
async proc => {
process.kill(proc.pid, 'SIGKILL');
wait_pid(proc.pid); //Free zombie state process
}
)
);