Skip to content

Commit 10be402

Browse files
authored
Fix ignored symbol graph extraction exit code (#7159)
### Motivation: Doesn't seem likely that symbol graph extraction process exit code was ignored on purpose, especially since `extractSymbolGraph` started returning process execution result recently. ### Modifications: Explicitly checked whether process exit code is 0. ### Result: Non-zero exit code from symbol graph extraction process launches are no longer ignored.
1 parent 923510e commit 10be402

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/Commands/Utilities/PluginDelegate.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import SPMBuildCore
1818

1919
import class TSCBasic.BufferedOutputByteStream
2020
import class TSCBasic.Process
21+
import struct TSCBasic.ProcessResult
2122

2223
final class PluginDelegate: PluginInvocationDelegate {
2324
let swiftTool: SwiftTool
@@ -376,14 +377,18 @@ final class PluginDelegate: PluginInvocationDelegate {
376377
try swiftTool.fileSystem.removeFileTree(outputDir)
377378

378379
// Run the symbol graph extractor on the target.
379-
try symbolGraphExtractor.extractSymbolGraph(
380+
let result = try symbolGraphExtractor.extractSymbolGraph(
380381
target: target,
381382
buildPlan: try buildSystem.buildPlan,
382383
outputRedirection: .collect,
383384
outputDirectory: outputDir,
384385
verboseOutput: self.swiftTool.logLevel <= .info
385386
)
386387

388+
guard result.exitStatus == .terminated(code: 0) else {
389+
throw ProcessResult.Error.nonZeroExit(result)
390+
}
391+
387392
// Return the results to the plugin.
388393
return PluginInvocationSymbolGraphResult(directoryPath: outputDir.pathString)
389394
}

0 commit comments

Comments
 (0)