SIGN IN SIGN UP
tw93 / Mole UNCLAIMED

🐹 Deep clean and optimize your Mac.

0 0 83 Shell

fix(uninstall): keep controlling tty in perl timeout fallback (#1003)

macOS ships neither timeout nor gtimeout, so run_with_timeout falls back
to the perl helper. setsid() there started a new session and detached the
controlling terminal, so nested sudo inside `brew uninstall --cask` zap
scripts could not reuse mole's cached ticket (sudo tty_tickets binds the
credential to a tty) nor prompt, failing with "a terminal is required".

setpgid(0, 0) keeps the inherited tty while still making the child a
process-group leader, so timeout-time `kill -TERM -$pid` group cleanup is
unchanged. setpgid returns 0 on success (falsy in perl), so it must not be
guarded with `or exit`. Adds perl-path exit-code/kill regression tests and
a source guard against reintroducing setsid.
T
Tw93 committed
aa9a3711e56ac4e26ca1799b7ae4a3114133c725
Parent: 2cad10c