Skip to content

Commit 296c401

Browse files
committed
Fix Flock PID locking
Remove race condition and fix warning log.
1 parent 90e77e4 commit 296c401

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/cli/pid.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (p *PIDFile) Acquire() error {
3232
if err != nil {
3333
logger.Warn().
3434
Err(err).
35-
Str("message", "Another pget process may be running, use 'pget multifile' to download multiple files in parallel").
35+
Str("warn_message", "Another pget process may be running, use 'pget multifile' to download multiple files in parallel").
3636
Msg("Waiting on Lock")
3737
logger.Debug().Str("blocking_lock_acquire", "true").Msg("Waiting on Lock")
3838
err = syscall.Flock(p.fd, syscall.LOCK_EX)
@@ -49,7 +49,6 @@ func (p *PIDFile) Release() error {
4949
funcs := []func() error{
5050
func() error { return syscall.Flock(p.fd, syscall.LOCK_UN) },
5151
p.file.Close,
52-
func() error { return os.Remove(p.file.Name()) },
5352
}
5453
return p.executeFuncs(funcs)
5554
}

0 commit comments

Comments
 (0)