fix: guard port_close in nova_watcher terminate#376
Merged
Taure merged 2 commits intonovaframework:masterfrom Mar 19, 2026
Merged
fix: guard port_close in nova_watcher terminate#376Taure merged 2 commits intonovaframework:masterfrom
Taure merged 2 commits intonovaframework:masterfrom
Conversation
…d ports port_close/1 raises error:badarg if the port already exited. This caused flaky test cancellations on OTP 26.1 when the port exited before terminate/2 ran.
Ports opened with open_port/2 are linked to the owning process and automatically closed by the VM when it exits. The explicit port_close was redundant and caused badarg crashes when the port had already exited before terminate/2 ran.
burbas
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nova_watcher:terminate/2callserlang:port_close/1on ports that may have already exited, raisingerror:badargtry/catchsinceport_close/1is a BIF with no safe return variantFixes flaky test cancellations on OTP 26.1 CI.
Test plan
rebar3 eunit— 347 tests, 0 failuresrebar3 xref— cleanrebar3 dialyzer— clean