Skip to content

Commit ec4bc27

Browse files
authored
Don't lock if we don't have a package root (#7335)
It seems like for reasons we have a fallback scratch directory even if we couldn't determine a package root, but it doesn't seem as if we should lock that since it is likely not the scratch directory we want.
1 parent 6bcbf11 commit ec4bc27

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sources/CoreCommands/SwiftTool.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,9 @@ public final class SwiftTool {
901901
}
902902

903903
fileprivate func acquireLockIfNeeded() throws {
904+
guard packageRoot != nil else {
905+
return
906+
}
904907
assert(workspaceLockState == .needsLocking, "attempting to `acquireLockIfNeeded()` from unexpected state: \(workspaceLockState)")
905908
guard workspaceLock == nil else {
906909
throw InternalError("acquireLockIfNeeded() called multiple times")

0 commit comments

Comments
 (0)