Description
Currently, if the first argument (i.e. argv[0]) of swift-driver is any absolute path or is resolvable to an executable, subcommands (i.e. argv[1]) will only be resolved relative to the compiler.
swift-driver/Sources/swift-driver/main.swift
Lines 122 to 131 in d2236ee
For example, when running swift subcommand
, since argv[0] is /usr/local/bin/swift
and argv[1] is subcommand
, swift-driver will launch /usr/local/bin/swift-subcommand
.
However, it would be helpful if swift-driver read the $PATH environment variable to determine which executable to launch in the event that the binary is not adjacent to the compiler.
For example, I could then create ~/.bin/swift-subcommand
, put that directory in my path, and then invoke it as swift subcommand
, without needing to edit my Swift installation.
This seems like the intended behavior here based on the comment above the relevant code, so the fact that this is not happening might be a bug.