Skip to content

Commit 3b87961

Browse files
committed
swift-help: use the executable suffix on Windows
Windows relies on the suffix for differentiating files. The use of `.exe` as the executable suffix is nearly universal on Windows. Ensure that we use that when targeting Windows, repairing the use of certain subcommands, e.g. `swift help build`. Fixes: #1404
1 parent 893f014 commit 3b87961

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/swift-help/main.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ struct SwiftHelp: ParsableCommand {
140140
case .subcommand(let subcommand):
141141
// Try to find the subcommand adjacent to the help tool.
142142
// If we didn't find the tool there, let the OS search for it.
143+
#if os(Windows)
144+
let execName = "swift-\(subcommand.rawValue).exe"
145+
#else
143146
let execName = "swift-\(subcommand.rawValue)"
147+
#endif
144148
let subcommandPath = Process.findExecutable(
145149
CommandLine.arguments[0])?
146150
.parentDirectory

0 commit comments

Comments
 (0)