Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit 4e36e86

Browse files
committed
Merge pull request #69 from madx/fix.no-exit-on-error-with-watch
Fixed: Prevent exiting on errors when using --watch option
2 parents e99bac9 + 90fd5ec commit 4e36e86

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

bin/cssnext

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ function transform() {
9696
console.error("If this error looks like a bug, please report it here:")
9797
console.error(colors.grey("❯ ") + pkg.bugs.url.cyan)
9898
console.error()
99-
exit(2)
99+
if (!program.watch) {
100+
exit(2)
101+
}
100102
}
101103
})
102104
}

test/cli.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,13 @@ test("cli", function(t) {
111111
})
112112
planned+=2
113113

114+
var childProcess = exec(cssnextBin + " --watch test/fixtures/cli.error.css test/fixtures/cli.output--watch.css", function(err, stdout, stderr) {
115+
t.ok(utils.contains(stderr, "encounters an error"), "should output error messages when `--watch` option passed")
116+
t.ok(err && err.signal === "SIGTERM", "should only be killed by an interrupt when `--watch` option passed")
117+
if (err && !err.killed) { throw err }
118+
})
119+
setTimeout(function() { childProcess.kill("SIGTERM") }, 2000)
120+
planned+=2
121+
114122
t.plan(planned)
115123
})

0 commit comments

Comments
 (0)