Skip to content

Commit

Permalink
feature(pkg): Print PID of process that created the lock file (#9295)
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Kubica <[email protected]>
  • Loading branch information
Leonidas-from-XIV authored Nov 28, 2023
1 parent e25ba5a commit b095252
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/dune_pkg/rev_store.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,17 @@ let with_flock lock_path ~f =
Unix_error.Detailed.create ue ~syscall:"flock" ~arg:"unlock"
|> Unix_error.Detailed.raise)
| Ok `Failure ->
Code_error.raise
(sprintf "Couldn't acquire lock after %d attempts to lock" max_retries)
[]
let pid = Io.read_file lock_path in
User_error.raise
~hints:
[ Pp.textf
"Another dune instance (pid %s) has locked the revision store. If this \
is happening in error, make sure to terminate that instance and re-run \
the command."
pid
]
[ Pp.textf "Couldn't acquire revision store lock after %d attempts" max_retries
]
| Error error ->
User_error.raise
[ Pp.textf
Expand Down

0 comments on commit b095252

Please sign in to comment.