diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index 457dbc4c9d..2aeff2532b 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -55,5 +55,6 @@ module.exports = { // listen for graceful termination process.on('SIGTERM', cleanup) process.on('SIGINT', cleanup) + process.on('SIGHUP', cleanup) } } diff --git a/test/cli/daemon.js b/test/cli/daemon.js index 4d5716df41..14207598da 100644 --- a/test/cli/daemon.js +++ b/test/cli/daemon.js @@ -110,6 +110,14 @@ describe('daemon', () => { }).catch(done) }) + skipOnWindows('should handle SIGHUP gracefully', function (done) { + this.timeout(100 * 1000) + + testSignal(ipfs, 'SIGHUP').then(() => { + checkLock(repoPath, done) + }).catch(done) + }) + it('gives error if user hasn\'t run init before', function (done) { this.timeout(100 * 1000)