question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

What version of Tailwind CSS are you using?

v3.0.24

What build tool (or framework if it abstracts the build tool) are you using?

Turborepo turbo run with tailwindcss cli

What version of Node.js are you using?

v16.15.1

What browser are you using?

N/A

What operating system are you using?

macOS

Reproduction URL

Describe your issue

Tailwind cli in watch mode exits early when run by turbo run. This makes it unusable in turborepo projects.

I’ve tracked it down to the event listeners on stdin

Because turbo repo doesn’t pipe through stdin, we get an end event back when calling process.stdin.resume()

I’ve added a potential solution in a PR on my fork here

I’m not completely sure you would consider it your issue, but I think there is merit in this flag being useful.

Issue #1026 on Turborepo

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
thecrypticacecommented, Jun 6, 2022

Wow that fix from esbuild really is super elegant! Ctrl-D, Ctrl-C, and Ctrl-Z all still work as expected in a terminal but launching without stdin works too. That’s pretty cool. I’ve just merged in the fix for this which should hit our insiders build in a few minutes.

Thanks for the investigation it was super helpful! 🎉

0reactions
thecrypticacecommented, Sep 14, 2022

We’ve run into some issues with this fix unfortunately and have reverted it for our next tagged release. What’s happening is that the CLI process is left running if the thing that launched it is unable to send a signal to the process. This can happen because either the parent process has crashed or because the runtime doesn’t have the ability to send signals (Erlang is an example of this).

However, it appears that Turborepo updated their Tailwind CSS example to use the concurrently npm package which happens to sidestep this problem entirely. This is because concurrently both doesn’t need stdin by default and handles it correctly for child processes. I would suggest updating your scripts to run the CLI using concurrently to ensure the CLI keeps working with the upcoming releases:

{
  "scripts": {
    "watch": "concurrently \"tailwindcss -i ./src/styles.css -o ./dist/styles.css --watch\""
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

CLI Reference - Turborepo
When --continue is true , turbo will exit with the highest exit code value encountered during execution. turbo run build --continue. --cwd.
Read more >
run-many - CLI command - Nx
Run target for multiple listed projects.
Read more >
Prevent Turborepo to exit early if a task fails to execute
By default, Turborepo will stop its execution if it runs into an error. ... We can do this by adding the --continue flag...
Read more >
Commands.dev - Find commands at the speed of thought
Commands.dev is a searchable, templated catalog of popular terminal commands curated from across the internet.
Read more >
Wireit | Best of JS
Use the npm run commands you already know; ⛓️ Automatically run dependencies between npm scripts in parallel; Watch any script and continuously re-run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found