Skip to content

Commit

Permalink
lock: don't interrupt at non terminal signals
Browse files Browse the repository at this point in the history
Signals like SIGWINCH (window resize) interrupt a blocking lock.
  • Loading branch information
rjbou committed Mar 27, 2019
1 parent 39d0157 commit 28c339e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/opamSystem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -821,8 +821,11 @@ let rec flock_update
OpamConsole.formatted_msg
"Another process has locked %s, waiting (%s to abort)... "
file (if Sys.win32 then "CTRL+C" else "C-c");
(try Unix.lockf fd (unix_lock_op ~dontblock:false flag) 0;
with Sys.Break as e -> OpamConsole.msg "\n"; raise e);
let rec lock_w_ignore_sig () =
try Unix.lockf fd (unix_lock_op ~dontblock:false flag) 0;
with Sys.Break as e -> (OpamConsole.msg "\n"; raise e)
| Unix.Unix_error (Unix.EINTR,_,_) -> lock_w_ignore_sig ()
in lock_w_ignore_sig ();
OpamConsole.msg "lock acquired.\n");
lock.kind <- (flag :> lock_flag)
| _ -> assert false
Expand Down

0 comments on commit 28c339e

Please sign in to comment.