Skip to content

Commit 2692d5f

Browse files
committed
Log the exit status of prepare and index processes to the index log
1 parent aa17664 commit 2692d5f

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

Sources/SKSupport/SwitchableProcessResultExitStatus.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ public enum SwitchableProcessResultExitStatus {
2121
case abnormal(exception: UInt32)
2222
/// The process was terminated due to a signal.
2323
case signalled(signal: Int32)
24+
25+
/// A description of the exit status that can be used in sentences like `Finished with <exit status description>`.
26+
public var description: String {
27+
switch self {
28+
case .terminated(code: let code):
29+
"exit code \(code)"
30+
case .abnormal(exception: let exception):
31+
"exception \(exception)"
32+
case .signalled(signal: let signal):
33+
"signal \(signal)"
34+
}
35+
}
2436
}
2537

2638
extension ProcessResult.ExitStatus {

Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,9 @@ extension SwiftPMBuildSystem: SKCore.BuildSystem {
631631
stderr: { stderrHandler.handleDataFromPipe(Data($0)) }
632632
)
633633
)
634-
logMessageToIndexLog(logID, "Finished in \(start.duration(to: .now))")
635-
switch result.exitStatus.exhaustivelySwitchable {
634+
let exitStatus = result.exitStatus.exhaustivelySwitchable
635+
logMessageToIndexLog(logID, "Finished with \(exitStatus.description) in \(start.duration(to: .now))")
636+
switch exitStatus {
636637
case .terminated(code: 0):
637638
break
638639
case .terminated(code: let code):

Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,9 @@ public struct UpdateIndexStoreTaskDescription: IndexTaskDescription {
370370
)
371371
)
372372
}
373-
374-
logMessageToIndexLog(logID, "Finished in \(start.duration(to: .now))")
375-
376-
switch result.exitStatus.exhaustivelySwitchable {
373+
let exitStatus = result.exitStatus.exhaustivelySwitchable
374+
logMessageToIndexLog(logID, "Finished with \(exitStatus.description) in \(start.duration(to: .now))")
375+
switch exitStatus {
377376
case .terminated(code: 0):
378377
break
379378
case .terminated(code: let code):

0 commit comments

Comments
 (0)