Skip to content

Commit 1963d73

Browse files
John ButeJohn Bute
John Bute
authored and
John Bute
committed
fixed bug where .build directory was not built yet when testing spm
1 parent 3b4eabd commit 1963d73

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Sources/Basics/Concurrency/PID.swift

+7
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ public struct PIDFile: PIDFileHandler {
6868

6969
/// Write .pid file containing PID of process currently using .build directory
7070
public func writePID(pid: pid_t) throws {
71+
let parent = self.lockFilePath.parentDirectory
72+
try FileManager.default.createDirectory(
73+
at: parent.asURL,
74+
withIntermediateDirectories: true,
75+
attributes: nil
76+
)
77+
7178
try "\(pid)".write(to: self.lockFilePath.asURL, atomically: true, encoding: .utf8)
7279
}
7380

Tests/CommandsTests/SwiftCommandStateTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ final class SwiftCommandStateTests: CommandsTestCase {
539539
let scratchPath = tmpDir.appending(component: "scratch")
540540
try localFileSystem.createDirectory(scratchPath)
541541

542-
var pidHandler = PIDFile(scratchDirectory: scratchPath)
542+
let pidHandler = PIDFile(scratchDirectory: scratchPath)
543543

544544
// Ensure no PID file exists initially
545545
XCTAssertNil(pidHandler.readPID(), "No PID should exist initially")

0 commit comments

Comments
 (0)