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.

Tailwind CLI outputs build stats to STDERR, causing certain build systems to treat successful builds as failures

See original GitHub issue

What version of Tailwind CSS are you using?

3.0.23

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

Tailwind CLI (npx tailwind)

What version of Node.js are you using?

16.14.2

What browser are you using?

N/A

What operating system are you using?

Linux (GH Codespaces)

Reproduction URL

https://github.com/eldarshamukhamedov/repro-tailwindcss-stderr/tree/main

Steps:

  1. Install NPM dependencies npm install
  2. Run npm run build to confirm there are no errors
  3. Run npm run build 2>stderr.txt to pipe the build STDERR output to the stderr.txt file

Expected:

  • A successful build does not output anything to STDERR (stderr.txt file is empty)

Actual:

  • A successful build outputs “Done in XXms.” to STDERR (stderr.txt file contains “Done in XXms.”)

Describe your issue

Some build systems (RushJS) treat any output to STDERR as a failed build, regardless of the process exit code.

From the repro steps above, you can see that tailwind build succeeds, and the process terminates with a clean exit code, but tailwind outputs the “Done in XXms.” string to STDERR, not STDOUT.

Since any output to STDERR implies that something went wrong, some build systems (e.g. RushJS) will assume the build failed.

Proposed solution

Output the build stats string (“Done in XXms”) to STDOUT, instead of STDERR. Continue to output actual build errors to STDERR.

Workarounds considered

It is possible to write a bash script that reads tailwind STDERR output, checks that the only output is the build stats string, and then “swallows” the output. The script would need to carefully parse the overall STDERR output and continue to output actual errors to STDERR. It’s doable, but a bit tricky.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
adamwathancommented, Apr 15, 2022

I’m going to close this since this behavior is not something we are likely to change but have made a note about the --silent option idea which I think definitely has value 👍🏻 Hopefully the solutions discussed here are helpful in the mean time, and thanks for the idea!

0reactions
thecrypticacecommented, Apr 12, 2022

The problem here is that stderr is not just for errors. Writing to stderr does not mean there is a failure. The documentation for stderr states explicitly that you can use it for diagnostic messages and warnings. You don’t (usually) print diagnostic messages to stdout because they’re not part of the normal output of the program. I’d say that RushJS is handling this incorrectly. They have a few open issues about this causing problems even for their own CI builds. As a workaround it appears you can set allowWarningsInSuccessfulBuild to true and Rush will let the build succeed.

A --silent flag or --level option could be a useful feature to have though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimizing for Production - Tailwind CSS
Tailwind CSS is incredibly performance focused and aims to produce the smallest CSS file possible by only generating the CSS you are actually...
Read more >
Available CRAN Packages By Date of Publication
Date, Package, Title. 2022-12-25, BDgraph, Bayesian Structure Learning in Graphical Models using Birth-Death MCMC. 2022-12-25, dibble, Dimensional Data ...
Read more >
Changelog | Meteor API Docs
New Tailwind skeleton. ... Fix issues with HMR and meteor build --debug PR ... can cause subsequent builds to fail because they will...
Read more >
Untitled
Luxemburg referate, Gun world gander, Inducible nitric oxide synthase review, Make me a channel of your peace piano, Vocational training centres in montreal ......
Read more >
(no subject)
Do you want a basic cli that can read traces and output text trace? ... A Linux kernel build has been tested successfully...
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