Skip to content

Commit fa71720

Browse files
committed
Use the assigned file system rather than the local one when available
1 parent ece030e commit fa71720

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Sources/Build/BuildOperation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,14 +455,14 @@ public final class BuildOperation: PackageStructureDelegate, SPMBuildCore.BuildS
455455
// Allow access to the plugin's output directory as well as to the local temporary directory.
456456
let sandboxProfile = SandboxProfile([
457457
.writable(pluginResult.pluginOutputDirectory),
458-
.writable(localFileSystem.tempDirectory)])
458+
.writable(self.fileSystem.tempDirectory)])
459459
commandLine = sandboxProfile.apply(to: commandLine)
460460
}
461461

462462
// Pass `TMPDIR` in the environment, in addition to anything the plugin specifies, in case we have an
463463
// override in our own environment.
464464
var environment = command.configuration.environment
465-
environment["TMPDIR"] = localFileSystem.tempDirectory.pathString
465+
environment["TMPDIR"] = self.fileSystem.tempDirectory.pathString
466466

467467
// Run the command and wait for it to finish.
468468
let processResult = try Process.popen(arguments: commandLine, environment: environment)

Sources/Build/LLBuildManifestBuilder.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,13 +624,13 @@ extension LLBuildManifestBuilder {
624624
if !self.disableSandboxForPluginCommands {
625625
let sandboxProfile = SandboxProfile([
626626
.writable(result.pluginOutputDirectory),
627-
.writable(localFileSystem.tempDirectory)])
627+
.writable(self.fileSystem.tempDirectory)])
628628
commandLine = sandboxProfile.apply(to: commandLine)
629629
}
630630
// Pass `TMPDIR` in the environment, in addition to anything the plugin specifies, in case we have an
631631
// override in our own environment.
632632
var environment = command.configuration.environment
633-
environment["TMPDIR"] = localFileSystem.tempDirectory.pathString
633+
environment["TMPDIR"] = self.fileSystem.tempDirectory.pathString
634634

635635
manifest.addShellCmd(
636636
name: displayName + "-" + ByteString(encodingAsUTF8: uniquedName).sha256Checksum,

Sources/Workspace/DefaultPluginScriptRunner.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public struct DefaultPluginScriptRunner: PluginScriptRunner, Cancellable {
396396
var sandbox = SandboxProfile()
397397

398398
// Allow writing in the temporary directory (whether or not it's overridden by TMPDIR).
399-
sandbox.pathAccessRules.append(.writable(localFileSystem.tempDirectory))
399+
sandbox.pathAccessRules.append(.writable(self.fileSystem.tempDirectory))
400400

401401
// But prevent writing in any read-only directories.
402402
sandbox.pathAccessRules.append(contentsOf: readOnlyDirectories.map{ .readonly($0) })
@@ -420,7 +420,7 @@ public struct DefaultPluginScriptRunner: PluginScriptRunner, Cancellable {
420420
// Pass `TMPDIR` in the environment, in addition to anything the plugin specifies. This lets us respect our own
421421
// override, and also makes sure that the plugin always knows what temporary directory we opened up for it.
422422
var environment = ProcessInfo.processInfo.environment
423-
environment["TMPDIR"] = localFileSystem.tempDirectory.pathString
423+
environment["TMPDIR"] = self.fileSystem.tempDirectory.pathString
424424
process.environment = environment
425425

426426
// Set up a pipe for sending structured messages to the plugin on its stdin.

0 commit comments

Comments
 (0)