// STOP

process.on('SIGINT', cleanExit)
process.on('SIGTERM', cleanExit)
process.on('uncaughtException', cleanExit)

function cleanExit(e) {
  if (e) console.log(e.stack)

  const children = Object.keys(process.children)

  // kill children
  children.forEach(key => {
    let child = process.children[key]

    // this seems to be required
    child && child.send('EXIT')

    setTimeout(() => {
      child &&  child.kill('SIGINT')
      process.exit(0)
    })
  })
}

export function now() { cleanExit() }

export default { now }

// STOP

process.on('SIGINT', cleanExit)
process.on('SIGTERM', cleanExit)
process.on('uncaughtException', cleanExit)

function cleanExit(e) {
  if (e) console.log(e.stack)

  const children = Object.keys(process.children || {})

  // kill children
  children.forEach(key => {
    let child = process.children[key]

    // this seems to be required
    child && child.send('EXIT')

    setTimeout(() => {
      child &&  child.kill('SIGINT')
      process.exit(0)
    })
  })
}

export function now() { cleanExit() }

export default { now }

Fix for scenario where we have no spawned children
:bug: Fix for scenario where we have no spawned children
