Skip to content

Commit 897d932

Browse files
authored
fix: guard port_close in nova_watcher terminate (#376)
1 parent a3c59db commit 897d932

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/nova_watcher.erl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,9 @@ handle_info(_Info, State) ->
185185
%%--------------------------------------------------------------------
186186
-spec terminate(Reason :: normal | shutdown | {shutdown, term()} | term(),
187187
State :: term()) -> any().
188-
terminate(_Reason, #state{process_refs = Refs}) ->
189-
%% Clean up the ports
190-
lists:foreach(fun(PortRef) ->
191-
erlang:port_close(PortRef)
192-
end, Refs),
188+
terminate(_Reason, _State) ->
189+
%% Ports opened with open_port/2 are linked to this process
190+
%% and automatically closed when it exits.
193191
ok.
194192

195193
%%--------------------------------------------------------------------

0 commit comments

Comments
 (0)