Skip to content

Commit

Permalink
Handle interrupts
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko committed Sep 27, 2024
1 parent 4f90a17 commit 854e1b5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/mix/lib/mix/lock.ex
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ defmodule Mix.Lock do
_ = :gen_tcp.send(socket, @probe_data)
accept_loop(listen_socket)

{:error, :eintr} ->
accept_loop(listen_socket)

{:error, reason} when reason in [:closed, :einval] ->
:ok
end
Expand Down Expand Up @@ -244,6 +247,9 @@ defmodule Mix.Lock do
:gen_tcp.close(socket)
{:error, :unexpected_port_owner}

{:error, :eintr} ->
await_probe_data(socket)

{:error, reason} ->
:gen_tcp.close(socket)
{:error, reason}
Expand Down Expand Up @@ -272,6 +278,9 @@ defmodule Mix.Lock do
{:error, :closed} ->
:ok

{:error, :eintr} ->
await_close(socket)

{:error, _other} ->
# In case of an unexpected error, we close the socket ourselves
# to retry
Expand Down

0 comments on commit 854e1b5

Please sign in to comment.