Skip to content

Commit 68adc9d

Browse files
authored
Include the default command search paths for plugin tool lookup. (#3984) (#3987)
(cherry picked from commit 751eb03)
1 parent ad0225d commit 68adc9d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Sources/Commands/SwiftPackageTool.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,8 +999,9 @@ extension SwiftPackageTool {
999999
writableDirectories.append(AbsolutePath(pathString, relativeTo: swiftTool.originalWorkingDirectory))
10001000
}
10011001

1002-
// Use the directory containing the compiler as an additional search directory.
1002+
// Use the directory containing the compiler as an additional search directory, and add the $PATH.
10031003
let toolSearchDirs = [try swiftTool.getToolchain().swiftCompilerPath.parentDirectory]
1004+
+ getEnvSearchPaths(pathString: ProcessEnv.path, currentWorkingDirectory: .none)
10041005

10051006
// Create the cache directory, if needed.
10061007
try localFileSystem.createDirectory(cacheDir, recursive: true)

Tests/CommandsTests/PackageToolTests.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,11 @@ final class PackageToolTests: CommandsTestCase {
12881288
print("Looking for swiftc...")
12891289
let swiftc = try context.tool(named: "swiftc")
12901290
print("... found it at \\(swiftc.path)")
1291+
1292+
// Check that we can find a standard tool.
1293+
print("Looking for sed...")
1294+
let sed = try context.tool(named: "sed")
1295+
print("... found it at \\(sed.path)")
12911296
}
12921297
}
12931298
"""

0 commit comments

Comments
 (0)