Skip to content

Commit

Permalink
Fix file lock issue on windows (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
anujc25 committed Aug 8, 2024
1 parent feb8f40 commit 6275a95
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/clientconfignextgen_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func ReleaseTanzuConfigNextGenLock() {
if cfgNextGenLock == nil {
return
}
if errUnlock := cfgNextGenLock.Unlock(); errUnlock != nil {
if errUnlock := cfgNextGenLock.Close(); errUnlock != nil {
panic(fmt.Sprintf("cannot release lock for tanzu config file, reason: %v", errUnlock))
}

Expand Down
4 changes: 2 additions & 2 deletions config/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func ReleaseTanzuConfigLock() {
if tanzuConfigLock == nil {
return
}
if errUnlock := tanzuConfigLock.Unlock(); errUnlock != nil {
if errUnlock := tanzuConfigLock.Close(); errUnlock != nil {
panic(fmt.Sprintf("cannot release lock for tanzu config file, reason: %v", errUnlock))
}

Expand Down Expand Up @@ -103,7 +103,7 @@ func getFileLockWithTimeOut(lockPath string, lockDuration time.Duration) (*filem
select {
case <-cancel:
// Timed out, cleanup if necessary.
_ = flock.Unlock()
_ = flock.Close()
case result <- err:
}
}()
Expand Down
2 changes: 1 addition & 1 deletion config/metadata_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func ReleaseTanzuMetadataLock() {
if tanzuMetadataLock == nil {
return
}
if errUnlock := tanzuMetadataLock.Unlock(); errUnlock != nil {
if errUnlock := tanzuMetadataLock.Close(); errUnlock != nil {
panic(fmt.Sprintf("cannot release lock for tanzu config metadata file, reason: %v", errUnlock))
}

Expand Down

0 comments on commit 6275a95

Please sign in to comment.