Skip to content

Commit

Permalink
Use Diagnostics.error when command failed (#5782)
Browse files Browse the repository at this point in the history
  • Loading branch information
enricenrich authored Sep 7, 2024
1 parent ae3f0c4 commit 27cab44
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Plugins/SwiftLintCommandPlugin/SwiftLintCommandPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct SwiftLintCommandPlugin: CommandPlugin {

try process.run()
process.waitUntilExit()

switch process.terminationReason {
case .exit:
Diagnostics.remark("Finished running in module '\(target.name)'")
Expand All @@ -40,9 +41,12 @@ struct SwiftLintCommandPlugin: CommandPlugin {
@unknown default:
Diagnostics.error("Stopped running in module '\(target.name) due to unexpected termination reason")
}

if process.terminationStatus != EXIT_SUCCESS {
Diagnostics.warning(
"Command found violations or unsuccessfully stopped running in module '\(target.name)'"
Diagnostics.error("""
Command found error violations or unsuccessfully stopped running with \
exit code \(process.terminationStatus) in module '\(target.name)'
"""
)
}
}
Expand Down

0 comments on commit 27cab44

Please sign in to comment.