Skip to content

Commit e8bc5da

Browse files
committed
[Commands] Use user namespaced temporary directory
- <rdar://problem/34130627> [SR-5788]: SwiftPM uses global tmp directory - https://bugs.swift.org/browse/SR-5788
1 parent 6fbe5ac commit e8bc5da

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/Commands/SwiftTool.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import SourceControl
1818
import Utility
1919
import Workspace
2020
import libc
21+
import func Foundation.NSUserName
2122

2223
struct ChdirDeprecatedDiagnostic: DiagnosticData {
2324
static let id = DiagnosticID(
@@ -432,7 +433,8 @@ public class SwiftTool<Options: ToolOptions> {
432433
assert(isFile(yaml), "llbuild manifest not present: \(yaml.asString)")
433434

434435
// Create a temporary directory for the build process.
435-
let tempDir = Basic.determineTempDirectory().appending(component: "swiftpm")
436+
let tempDirName = "org.swift.swiftpm.\(NSUserName())"
437+
let tempDir = Basic.determineTempDirectory().appending(component: tempDirName)
436438
try localFileSystem.createDirectory(tempDir, recursive: true)
437439

438440
// Run the swift-build-tool with the generated manifest.

0 commit comments

Comments
 (0)