Skip to content

Commit

Permalink
fix: cleanup debug messaging on killing node proc
Browse files Browse the repository at this point in the history
  • Loading branch information
okdistribute committed Sep 22, 2020
1 parent f7ff55e commit a784e8c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/pid-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Worker extends events.EventEmitter {
create ({socketName, filepath}, cb) {
logger.debug('Creating subprocess', socketName, filepath)
this.cleanup((err) => {
if (err) logger.debug('Not fatal', err)
if (err) logger.error(err)
logger.debug('Starting background process')
this.process = fork(filepath, [
'--subprocess',
Expand Down Expand Up @@ -62,11 +62,10 @@ class Worker extends events.EventEmitter {
cleanup (cb) {
if (this.process) this.process.kill()
this.process = null
if (!this._exists()) return cb(new Error('Nothing to clean up!'))
if (!this._exists()) return cb()
var pid = this.read()
logger.info('Terminating PID', pid)
terminate(pid, (err) => {
if (err) logger.error(err)
if (err && err.code !== 'ESRCH') return cb(err)
this._remove(cb)
})
Expand Down

0 comments on commit a784e8c

Please sign in to comment.