#874·watchexec

Command hangs if it tries to set terminal modes

Author: bjackmanCreated Nov 6, 2024Updated May 21, 2026
Labelsbug

Please delete this template text before filing, but you need to include the following:

Using Debian testing.

❯❯  watchexec --version
watchexec 2.2.0 (2024-11-05) +pid1
build-date: 2024-11-05
release: 2.2.0
features: default,pid1

The actual use case that motivated this is the linux kernel's kunit.py. This runs QEMU under the hood and QEMU often runs annoying firmware that makes a mess of the terminal. So it runs stty sane to clean that up.

The issue is that stty sane command hangs when run via watchexec. Here's a log of running watchexec stty sane and then interrupting it, it takes 10s to shutdown.

Based on this log from running watchexec strace stty sane I think what's goin on here is that the child process that watchexec runs is not "in the foreground job of a controlling terminal" and that means it gets SIGTTOU and it hangs when that happens.

I'm really not too sure what's at fault here - I might also be totally wrong about what the exact issue is. Maybe someone knows better than me?