Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TUI stopped working in 1.24.0 #743

Closed
LucasPickering opened this issue Dec 21, 2023 · 4 comments
Closed

TUI stopped working in 1.24.0 #743

LucasPickering opened this issue Dec 21, 2023 · 4 comments
Labels
not a bug Might actually be a feature, or a non-bug issue

Comments

@LucasPickering
Copy link

LucasPickering commented Dec 21, 2023

I use watchexec for TUI development, and after updating to 1.24.0 it stopped working. When I run watchexec -- cargo run now, it compiles then hangs with no output shown. On 1.23.0, the TUI would take over the screen as expected. I downgraded to confirm the probably started with 1.24.0

  • OS version: MacOS 14.2.1

I think the easiest way to reproduce this is to run one of ratatui's examples.

  • Clone the ratatui repo
  • watchexec -- cargo run --example block

Here's the log output from that command on 1.24.0:

{"timestamp":"2023-12-21T02:16:48.184528Z","level":"INFO","fields":{"message":"running main loop"},"target":"watchexec_cli"}
{"timestamp":"2023-12-21T02:16:48.184551Z","level":"DEBUG","fields":{"message":"handing over main task handle"},"target":"watchexec::watchexec"}
{"timestamp":"2023-12-21T02:16:48.184565Z","level":"DEBUG","fields":{"message":"starting main task"},"target":"watchexec::watchexec"}
{"timestamp":"2023-12-21T02:16:48.184609Z","level":"DEBUG","fields":{"message":"launching unix signal worker"},"target":"watchexec::sources::signal"}
{"timestamp":"2023-12-21T02:16:48.184660Z","level":"DEBUG","fields":{"message":"launching filesystem worker"},"target":"watchexec::sources::fs"}
{"timestamp":"2023-12-21T02:16:48.184663Z","level":"DEBUG","fields":{"message":"running action handler"},"target":"watchexec::action::worker"}
{"timestamp":"2023-12-21T02:16:48.184665Z","level":"DEBUG","fields":{"message":"creating new watcher","kind":"Native"},"target":"watchexec::sources::fs"}
{"timestamp":"2023-12-21T02:16:48.184723Z","level":"DEBUG","fields":{"message":"applying changes to the watcher","to_watch":"[WatchedPath(\"/Users/lucas/git/ratatui\")]","to_drop":"[]"},"target":"watchexec::sources::fs"}
{"timestamp":"2023-12-21T02:16:48.184801Z","level":"DEBUG","fields":{"message":"take control of new tasks"},"target":"watchexec::action::worker"}
{"timestamp":"2023-12-21T02:16:48.184806Z","level":"DEBUG","fields":{"message":"action handler finished"},"target":"watchexec::action::worker"}
@LucasPickering LucasPickering added the bug Something's not right! label Dec 21, 2023
@passcod
Copy link
Member

passcod commented Dec 21, 2023

Maybe like in #742, I wonder, does it work with --no-process-group?

@LucasPickering
Copy link
Author

@passcod Yep, it works with --no-process-group

@passcod
Copy link
Member

passcod commented Dec 21, 2023

Yeah, that's due to a fix in how process grouping was implemented. It used to do setsid, but was always meant to do sedpgid, as the signal handling was predicated on it being setpgid, and it matches the Windows API better.

Unfortunately it also turns out that the setsid behaviour spuriously allowed some (but not all!) things like TUIs. You'll have to use that option from now on, and take care to do signal handling and child reaping if needed.

In future watchexec will add another option to allocate and run in a pty, which may help even more for the TUI case, and on Linux another option will spawn in cgroups when available, which will also help for non-pgid/sid process grouping cases.

@passcod passcod closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2023
@passcod passcod added not a bug Might actually be a feature, or a non-bug issue and removed bug Something's not right! labels Dec 21, 2023
@LucasPickering
Copy link
Author

Ah, thanks for the explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not a bug Might actually be a feature, or a non-bug issue
Projects
None yet
Development

No branches or pull requests

2 participants