diff --git a/package.json b/package.json index f99fdd39..f33e0265 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "dependencies": { "async": "^2.6.0", "boom": "^7.1.1", + "debug": "^3.1.0", "detect-node": "^2.0.3", "hapi": "^16.6.2", "hat": "0.0.3", @@ -79,6 +80,7 @@ "readable-stream": "^2.3.3", "rimraf": "^2.6.2", "safe-json-parse": "^4.0.0", + "shutdown": "^0.3.0", "ipfs-api": "^17.3.0", "stream-http": "^2.7.2", "subcomandante": "^1.0.5", diff --git a/src/daemon-node.js b/src/daemon-node.js index 2f35acd3..955ba317 100644 --- a/src/daemon-node.js +++ b/src/daemon-node.js @@ -10,6 +10,7 @@ const once = require('once') const truthy = require('truthy') const utils = require('./utils') const flatten = require('./utils').flatten +const debug = require('debug')('ipfsd-ctl:deamon-node') const tryJsonParse = utils.tryJsonParse const parseConfig = utils.parseConfig @@ -262,6 +263,7 @@ class Node { // need a local var for the closure, as we clear the var. const subprocess = this.subprocess const timeout = setTimeout(() => { + debug('kill timeout, using SIGKILL', subprocess.pid) subprocess.kill('SIGKILL') callback() }, GRACE_PERIOD) @@ -269,6 +271,7 @@ class Node { const disposable = this.disposable const clean = this.cleanup.bind(this) subprocess.once('close', () => { + debug('killed', subprocess.pid) clearTimeout(timeout) this.subprocess = null this._started = false @@ -278,6 +281,7 @@ class Node { callback() }) + debug('killing', subprocess.pid) subprocess.kill('SIGTERM') this.subprocess = null } diff --git a/src/exec.js b/src/exec.js index 3830c3f0..a846daa8 100644 --- a/src/exec.js +++ b/src/exec.js @@ -2,6 +2,8 @@ const run = require('subcomandante') const once = require('once') +const debug = require('debug')('ipfsd-ctl:exec') +const path = require('path') function exec (cmd, args, opts, handlers) { opts = opts || {} @@ -47,6 +49,7 @@ function exec (cmd, args, opts, handlers) { }) } + debug(path.basename(cmd), args.join(' ')) const command = run(cmd, args, opts) if (listeners.data) {