Skip to content

Conversation

@thecrypticace
Copy link
Contributor

Fixes #19420

These can cause `fs.readFile()` to hang waiting for the file descriptor to be closed.
@thecrypticace thecrypticace requested a review from a team as a code owner December 8, 2025 21:51
@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

Walkthrough

Adds a pre-check in the build utility to detect special file types (character devices or FIFOs) using fs.stat. If the target is a special file, the code skips reading existing contents to avoid hanging and proceeds to ensure the parent directory exists and write the file. For non-special files, the previous behavior remains: read current contents, skip writes when identical, then ensure directories and write. The public function signature is unchanged; changes are internal control flow and comments.

Pre-merge checks

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Don't try reading from pipes or special file descriptors' clearly summarizes the main change addressing the hanging issue when outputting to special files like /dev/stdout.
Description check ✅ Passed The description 'Fixes #19420' is related to the changeset, referencing the linked issue about the /dev/stdout hanging problem.
Linked Issues check ✅ Passed The PR correctly implements a fix by detecting special files (character devices/FIFOs) and skipping the read operation to prevent hanging, directly addressing issue #19420's requirement that --output /dev/stdout should complete without hanging.
Out of Scope Changes check ✅ Passed All changes are in-scope: the fs.stat pre-check in utils.ts targets the core issue, and the CHANGELOG.md entry documents the fix without introducing unrelated modifications.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c3e2f6 and fe4b1a1.

📒 Files selected for processing (1)
  • packages/@tailwindcss-cli/src/commands/build/utils.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/@tailwindcss-cli/src/commands/build/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Linux / postcss
  • GitHub Check: Linux / vite
  • GitHub Check: Linux
  • GitHub Check: Linux / cli
  • GitHub Check: Linux / upgrade

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdc851d and eb59260.

📒 Files selected for processing (1)
  • packages/@tailwindcss-cli/src/commands/build/utils.ts (1 hunks)
🔇 Additional comments (2)
packages/@tailwindcss-cli/src/commands/build/utils.ts (2)

16-17: Clear documentation of the fix.

The comment effectively explains why special files require different handling and prevents future regressions.


22-33: Conditional logic and write operations are correct.

The control flow properly skips reading for special files while preserving the optimization that avoids unnecessary writes for regular files when content is unchanged. Directory creation and file writing remain robust.

Note: This assessment assumes the critical issue with stat error handling (lines 18-21) is addressed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
CHANGELOG.md (1)

27-27: Clarify scope to match the actual fix (pipes/char devices too).

The change handles more than just /dev/stdout. Consider wording it to reflect special files so users know FIFOs/char devices are covered.

- - CLI: Don't hang when output is `/dev/stdout` ([#19421](https://github.com/tailwindlabs/tailwindcss/pull/19421))
+ - CLI: Avoid hangs when output is `/dev/stdout` or another special file (FIFO/char device) ([#19421](https://github.com/tailwindlabs/tailwindcss/pull/19421))
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb59260 and 0c3e2f6.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Linux / cli
  • GitHub Check: Linux / upgrade
  • GitHub Check: Linux

@thecrypticace thecrypticace merged commit 164194d into main Dec 8, 2025
7 checks passed
@thecrypticace thecrypticace deleted the fix/issue-19420 branch December 8, 2025 22:04
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 Version 4.1.17 hangs when using --output /dev/stdout

3 participants