Skip to content

CLI: Only listen for stdin close on TTYs#8523

Merged
thecrypticace merged 1 commit into
masterfrom
fix/close-on-tty-only
Jun 6, 2022
Merged

CLI: Only listen for stdin close on TTYs#8523
thecrypticace merged 1 commit into
masterfrom
fix/close-on-tty-only

Conversation

@thecrypticace

Copy link
Copy Markdown
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