Skip to content

Commit f4e241f

Browse files
committed
fix flock not locking correctly when launched from i3
actually not sure what the cause is, but using a simpler logic now and letting the OS release the lock instead of doing it manually
1 parent 47718d2 commit f4e241f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ func handleInterruptSignal() {
271271
func main() {
272272
file, err := os.OpenFile(lockFile, os.O_CREATE|os.O_RDWR, 0644)
273273
if err == nil {
274-
defer os.Remove(lockFile)
275274
defer file.Close()
276275

277276
// Try to lock the file
@@ -280,7 +279,7 @@ func main() {
280279
log.Info("Another instance of Launchy is already running.")
281280
return
282281
}
283-
defer syscall.Flock(int(file.Fd()), syscall.LOCK_UN)
282+
log.Info("Lock acquired. Launchy is starting...")
284283
} else {
285284
log.Warnf("Failed to create/open lock file: %s", err)
286285
return

0 commit comments

Comments
 (0)