Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --ignore-stdin flag to cli, this disables stdin listeners #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ let commands = {
type: Boolean,
description: 'Disable autoprefixer',
},
'--ignore-stdin': {
type: Boolean,
description:
'Disable stdin listeners. Only use in combination with --watch flag.\n\t\t\t For use when running tailwindcss cli as a child process without connection to parent stdin',
},
'-c': '--config',
'-i': '--input',
'-o': '--output',
Expand Down Expand Up @@ -418,6 +423,7 @@ async function build() {
let shouldPoll = args['--poll']
let shouldCoalesceWriteEvents = shouldPoll || process.platform === 'win32'
let includePostCss = args['--postcss']
let ignoreStdIn = args['--ignore-stdin'] || false

// Polling interval in milliseconds
// Used only when polling or coalescing add/change events on Windows
Expand Down Expand Up @@ -885,9 +891,11 @@ async function build() {
}

if (shouldWatch) {
/* Abort the watcher if stdin is closed to avoid zombie processes */
process.stdin.on('end', () => process.exit(0))
process.stdin.resume()
if (!ignoreStdIn) {
/* Abort the watcher if stdin is closed to avoid zombie processes */
process.stdin.on('end', () => process.exit(0))
process.stdin.resume()
}
startWatcher()
} else {
buildOnce()
Expand Down