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

CLI: Only listen for stdin close on TTYs #8523

Merged
merged 1 commit into from
Jun 6, 2022

Conversation

thecrypticace
Copy link
Contributor

We have an incompatibility with turborepo because it doesn't pipe stdin to child processes. We currently always listen for stdin close (by closing the file descriptor, or in a TTY by pressing Ctrl + D) as a way to kill the process. If an app starts the Tailwind CLI with stdin closed it won't watch any files because as soon as we call resume we get an end event and exit.

To work around this we'll only wire up these listeners if the process is run in a terminal (a TTY) rather than as a general child process. I've verified this fix by running it in zsh but closed the file descriptor first: 0<&- ./lib/cli.js --watch input.css. If an input file is not provided we still try to read from stdin which exits as expected because we can't read from stdin since there is no pipe.

Fixes #8517

@thecrypticace thecrypticace merged commit 14f6574 into master Jun 6, 2022
@thecrypticace thecrypticace deleted the fix/close-on-tty-only branch June 6, 2022 14:04
thecrypticace added a commit that referenced this pull request Sep 14, 2022
thecrypticace added a commit that referenced this pull request Sep 14, 2022
* Revert "Only listen for stdin close on TTYs (#8523)"

This reverts commit 14f6574.

* Update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cli exits process instantly when called by turborepo's run command in watch mode
1 participant