Skip to content

Commit 6103661

Browse files
authored
Merge pull request #1346 from ahoppen/reveal-diag-bundle
On macOS, reveal diagnostic bundle in Finder after it has been created
2 parents 31a8cf3 + 8cb6136 commit 6103661

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/Diagnose/DiagnoseCommand.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,15 @@ public struct DiagnoseCommand: AsyncParsableCommand {
352352
"""
353353
)
354354

355+
#if os(macOS)
356+
// Reveal the bundle in Finder on macOS
357+
do {
358+
let process = try Process.launch(arguments: ["open", "-R", bundlePath.path], workingDirectory: nil)
359+
try await process.waitUntilExitSendingSigIntOnTaskCancellation()
360+
} catch {
361+
// If revealing the bundle in Finder should fail, we don't care. We still printed the bundle path to stdout.
362+
}
363+
#endif
355364
}
356365

357366
@MainActor

0 commit comments

Comments
 (0)