Skip to content

Commit

Permalink
Fix looking up for self (the driver executable)
Browse files Browse the repository at this point in the history
The `arguments` is modified by `Driver.invocationRunMode`, so the first
element is no longer the driver itself.
  • Loading branch information
stevapple committed Apr 20, 2022
1 parent 2ec15a1 commit e0de0af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/swift-driver/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ do {
if case .subcommand(let subcommand) = mode {
// We are running as a subcommand, try to find the subcommand adjacent to the executable we are running as.
// If we didn't find the tool there, let the OS search for it.
let subcommandPath = Process.findExecutable(arguments[0])?.parentDirectory.appending(component: subcommand)
let subcommandPath = Process.findExecutable(CommandLine.arguments[0])?.parentDirectory.appending(component: subcommand)
?? Process.findExecutable(subcommand)

if subcommandPath == nil || !localFileSystem.exists(subcommandPath!) {
Expand Down

0 comments on commit e0de0af

Please sign in to comment.