From c527e1ef87ec79818c7c1376e8451676782e4f6e Mon Sep 17 00:00:00 2001 From: typicode Date: Mon, 28 Nov 2016 13:30:43 +0100 Subject: [PATCH] Fix nohup issue --- CHANGELOG.md | 5 +++++ src/cli/run.js | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b90412d7..4179153a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## [Unreleased][Unreleased] + +* Fix [#221](https://github.com/typicode/json-server/issues/221) nohup support +* Fix [#420](https://github.com/typicode/json-server/issues/420) TypeError when watching db.json + ## [0.9.1][2016-11-21] * Fix diff --git a/src/cli/run.js b/src/cli/run.js index 1dc7fd1a4..49a5fd3e9 100644 --- a/src/cli/run.js +++ b/src/cli/run.js @@ -160,7 +160,11 @@ module.exports = function (argv) { chalk.gray(' Type s + enter at any time to create a snapshot of the database') ) - process.stdin.resume() + // Support nohup + // https://github.com/typicode/json-server/issues/221 + process.stdin.on('error', (err) => { + console.log(' Error, can\'t read from stdin') + }) process.stdin.setEncoding('utf8') process.stdin.on('data', (chunk) => { if (chunk.trim().toLowerCase() === 's') {