Skip to content

Commit

Permalink
Merge pull request #10 from vdayanand/v/dexfix
Browse files Browse the repository at this point in the history
fix: Remove corrupted pidfile
  • Loading branch information
tanmaykm authored Feb 27, 2023
2 parents fff6aff + 4dd8520 commit 11a79b3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Dex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ mutable struct DexCtx
ctx = new(workdir, nothing, nothing)
pfile = pidfile(ctx)
if isfile(pfile)
ctx.pid = parse(Int, read(pidfile(ctx), String))
isrunning(ctx)
ctx.pid = try
parse(Int, read(pidfile(ctx), String))
catch ex
@info "removing corrupted pid file"
rm(pidfile)
rethrow(ex)
end
if !isrunning(ctx)
ctx.pid = nothing
end
end
ctx
end
Expand Down

0 comments on commit 11a79b3

Please sign in to comment.