FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Allow non-TTY stdin watch mode by 0xradical · Pull Request #448 · postcss/postcss-cli · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 7 additions & 1 deletion index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ let configFile
if (argv.env) process.env.NODE_ENV = argv.env
if (argv.config) argv.config = path.resolve(argv.config)

if (argv.watch) {
let { isTTY } = process.stdin

if (process.env.FORCE_IS_TTY === 'true') {
isTTY = true
}

if (argv.watch && isTTY) {
process.stdin.on('end', () => process.exit(0))
process.stdin.resume()
}
Expand Down
5 changes: 5 additions & 0 deletions test/watch.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,18 @@ testCb('--watch does exit on closing stdin (Ctrl-D/EOF)', (t) => {

const cp = spawn(`./index.js test/fixtures/a.css -o ${tmp()} -w --no-map`, {
shell: true,
env: {
...process.env,
FORCE_IS_TTY: true,
},
})

cp.on('error', t.end)
cp.on('exit', (code) => {
t.is(code, 0)
t.end()
})

cp.stdin.end()
})

Expand Down

Back | FazBrowse Home | New Git URL