Skip to content

Commit 9625021

Browse files
authored
Improve swift-run failure mode (#3685)
In the case that you used `swift run`, and your executable failed to build, previously you would see this output, at the bottom of a potentially long list of warnings: ``` error: fatalError ``` In some cases, especially with lots of build output, this makes it look like your command ran, but your program failed, not the build. This silences that message, since the point of that error is that some other diagnostics should have been printed anyways.
1 parent 376fd15 commit 9625021

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Sources/Commands/SwiftRunTool.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ public struct SwiftRunTool: SwiftCommand {
198198
try run(executablePath,
199199
originalWorkingDirectory: swiftTool.originalWorkingDirectory,
200200
arguments: options.arguments)
201+
} catch Diagnostics.fatalError {
202+
throw ExitCode.failure
201203
} catch let error as RunError {
202204
swiftTool.diagnostics.emit(error)
203205
throw ExitCode.failure

0 commit comments

Comments
 (0)