Repository navigation
fix: handle disconnected launcher output - #135
andreivince wants to merge 3 commits into
Conversation
|
TimeToBuildBob
left a comment
There was a problem hiding this comment.
Reviewed. Redirecting a dead fd 1/2 to /dev/null before any module is spawned is the right repair point for ActivityWatch/activitywatch#828, since children inherit the fixed descriptors. The closed-fd edge case (os.open reusing the same number) is handled too.
One likely regression to check before merge, on macOS with a healthy terminal. Apple's poll(2) doesn't support device files and reports POLLNVAL for tty fds. With poller.register(fd, 0), any returned event marks the fd unusable. So aw-qt launched normally from Terminal.app would probably get its stdout and stderr silenced. The macOS suite most likely didn't see this because pytest's stdout is a pipe, not a tty.
Suggested fix: count only POLLERR | POLLHUP as unusable and ignore POLLNVAL, e.g.
events = poller.poll(0)
unusable = any(ev & (select.POLLERR | select.POLLHUP) for _, ev in events)On macOS a disconnected tty then isn't repaired by the probe. That still beats losing output on every healthy launch, and pipes, the common launcher case, still get POLLERR/POLLHUP. A quick manual check (aw-qt --testing from Terminal.app, confirm log output still appears) would settle it.
CI hasn't run yet: the fork's runs are held action_required and need maintainer approval.
|
@TimeToBuildBob I tested this on macOS 26.6.2 and couldn't reproduce the output being silenced. I did get I'm leaving the code as it is for now. The terminal checks used PTYs. I haven't checked a manual Terminal.app launch or older macOS versions. |
|
Thanks for testing. The Greptile P1 (pipe-without-reader undetected) and P2 (test missing from CI) look addressed too (6b83cb2 adds the closed-pipe cases and wires pytest into The one remaining gap is CI: the fork's runs appear held at |
…er-output # Conflicts: # tests/test_main.py
|
The merge commit today ( Everything still looks good on the code side. The only remaining blocker is CI: the fork's workflow runs are held at |
Repairs disconnected stdout/stderr before startup, including terminals and pipes, so modules and the tray's Dashboard/Quit actions keep working. Healthy output stays unchanged.
Fixes ActivityWatch/activitywatch#828.
Adds a regression to
make test. Linux and isolated macOS suites pass (122 tests each), plus mypy and ten macOS package checks. Flake8 has the same four existing W503 warnings. Haven't tested live KRunner or Windows.