You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code works without errors in Unix and ends with error Remove of lock file failed with: remove C:\Users\i019379\go\src\testLocking\lock.lock: The process cannot access the file because it is being used by another process. in Windows.
Thus in Windows it's impossible to remove lock file if more then one process tried to make locking.
funcmain(){
wd, _:=os.Getwd()
lockfile:=filepath.Join(wd, "lock.lock")
lock1:=flock.New(lockfile)
locked1, _:=lock1.TryLock()
if!locked1{
fmt.Println("Error - First tryLock failed")
return
}
lock2:=flock.New(lockfile)
locked2, _:=lock2.TryLock()
iflocked2{
fmt.Println("Second tryLock succeeded")
return
}
err:=lock2.Unlock()
iferr!=nil {
fmt.Println("Unlock of second lock failed")
return
}
err=lock1.Unlock()
iferr!=nil {
fmt.Println("Unlock of first lock failed")
return
}
err=os.Remove(lockfile)
iferr!=nil {
fmt.Println("Remove of lock file failed with: "+err.Error())
return
}
}
The text was updated successfully, but these errors were encountered:
I'm seeing this error using Windows via GitHub Actions:
profile_test.go:790: want no error, have error saving config file: error writing to config file: write C:\Users\RUNNER~1\AppData\Local\Temp\fastly-temp-2402719425\config.toml: The process cannot access the file because another process has locked a portion of the file.
[139](https://github.com/fastly/cli/runs/7153347993?check_suite_focus=true#step:11:140)
I tried to reproduce the problem (I use the code in the issue description) on GitHub Action (Windows), but I could not get the error with v0.7.2, v0.7.3, v0.8.0, v0.8.1, and v0.9.0, etc.
The following code works without errors in Unix and ends with error
Remove of lock file failed with: remove C:\Users\i019379\go\src\testLocking\lock.lock: The process cannot access the file because it is being used by another process.
in Windows.Thus in Windows it's impossible to remove lock file if more then one process tried to make locking.
The text was updated successfully, but these errors were encountered: