Skip to content

Commit

Permalink
only exit on watch if stdin is TTY
Browse files Browse the repository at this point in the history
check if stdin is TTY before checking "end" event,
as non-TTY stdin will always invoke end and exit.

found from running "postcss -w" in a docker container (#370)
and running "postcss -w" in lerna or turborepo.
  • Loading branch information
ToppleTheNun committed Jan 18, 2022
1 parent c9f6905 commit 89d08b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ let configFile
if (argv.env) process.env.NODE_ENV = argv.env
if (argv.config) argv.config = path.resolve(argv.config)

if (argv.watch) {
if (argv.watch && process.stdin.isTTY) {
process.stdin.on('end', () => process.exit(0))
process.stdin.resume()
}
Expand Down

0 comments on commit 89d08b3

Please sign in to comment.