maralorn / nix-output-monitor

Pipe your nix-build output through the nix-output-monitor a.k.a nom to get additional information while building.
GNU Affero General Public License v3.0
895 stars 27 forks source link

gracefully exit when confronted with different error conditions. #114

Closed maralorn closed 1 year ago

maralorn commented 1 year ago

SIGINT seems to be fine but SIGTERM does not work.

Mic92 commented 1 year ago

Actually I tested. Stopping with SIGINT also causes the cursor not to be restored here. In https://github.com/Mic92/nix-ci-build I do something like: (nix-build ...; nix-build ...) >&2 | nom and than send a normal SIGTERM or SIGINT. Looks like https://code.maralorn.de/maralorn/nix-output-monitor/src/commit/6ca91b73f9e51b4486b3542c23d496f470026e2b/exe/Main.hs#L128 doesn't cover any of these case. Next I will try to just close the pipe and wait for nom to terminate.

Mic92 commented 1 year ago

Turns out it doesn't handle any signal and closing the pipe followed by waiting for nom to exit, fixes it: https://github.com/Mic92/nix-ci-build/commit/8c84a91e40d5e9e34d698d1c6127395c25bbc209#diff-9d885e639e896c471d700b09b2d5cddc505f12f7fea6f369bce4c392b0655805R404