cortesi / modd

A flexible developer tool that runs processes and responds to filesystem changes
MIT License
2.8k stars 128 forks source link

`daemon: tailwind --watch` exits and restarts in a loop #129

Open marcuswhybrow opened 11 months ago

marcuswhybrow commented 11 months ago

modd.conf

tailwind.config.js {
  daemon: tailwind --watch --output ./build/tailwind.css
}

Output of running modd

11:16:21: daemon: tailwind --watch --output ./build/tailwind.css

Rebuilding...
exited: exit status 0
>> restart backoff... 1000ms
>> starting...

Rebuilding...
exited: exit status 0
>> restart backoff... 2000ms

Which continues forever.

Expected output:

Rebuilding...

Done in 977ms.
marcuswhybrow commented 7 months ago

Still an issue with tailwind v3.4.1 and modd v0.8

wader commented 7 months ago

Same with modd master? the only other things i can think of is the either the env or stdin/stdout/stderr is different. To look at env maybe add a env ; ... before and see if you see something fishy, for stdin/stdout/stderr maybe do tailwind --watch --output ./build/tailwind.css 2>&1 < /dev/null | cat in an interactive shell to force stderr/stdout to a non-tty and stdin reading from null device (seems to be what will end up happening).

wader commented 7 months ago

Try this daemon: tailwind --watch --output ./build/tailwind.css < /dev/stdin but i'm not sure hows stdin that will be, i guess it will be modd's that gets inherited down

marcuswhybrow commented 7 months ago

Same with modd master?

If I have time I'll look into the master build.

Try this daemon: tailwind --watch --output ./build/tailwind.css < /dev/stdin

Issue persists.

wader commented 7 months ago

Now when i think about it stdin will probably be /dev/null also, maybe something like sleep 999999 | tailwind ... could make tailwind have a stdin to block on and be happy, i suspect it exits when stdin ends

marcuswhybrow commented 7 months ago

Wow, that did it! Great thinking, I had no idea stdin was both needed, and didn't exist.

wader commented 7 months ago

🥳 do you know if other modd-like tools have the same issue with tailwind? not really sure what "foregrounded" tools should expect from stdin hmm

marcuswhybrow commented 7 months ago

Sorry, only used tailwind with modd, (inside Nix develop).