Skip to content

postcss-cli 9.1.0 watch cannot be run without tty #426

@ToppleTheNun

Description

@ToppleTheNun

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch postcss-cli@9.1.0 for the project I'm working on.

found from running postcss -w in a docker container (#370) and running postcss -w in lerna or turborepo.

Here is the diff that solved my problem:

diff --git a/node_modules/postcss-cli/index.js b/node_modules/postcss-cli/index.js
index 615638c..28244e6 100644
--- a/node_modules/postcss-cli/index.js
+++ b/node_modules/postcss-cli/index.js
@@ -61,7 +61,7 @@ let configFile
 if (argv.env) process.env.NODE_ENV = argv.env
 if (argv.config) argv.config = path.resolve(argv.config)
 
-if (argv.watch) {
+if (argv.watch && process.stdin.isTTY) {
   process.stdin.on('end', () => process.exit(0))
   process.stdin.resume()
 }

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions