Skip to content

Commit ac53071

Browse files
committed
Improve error output when a process fails to launch
This relates to #836 where failing to spawn a process says nothing about _which_ process failed to spawn.
1 parent 5552e48 commit ac53071

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sources/SWBUtil/Process.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,13 @@ extension Process {
175175

176176
async let outputTask = await collect(streams)
177177

178-
try await process.run(interruptible: interruptible)
178+
do {
179+
try await process.run(interruptible: interruptible)
180+
} catch is CancellationError {
181+
throw CancellationError()
182+
} catch {
183+
throw try RunProcessLaunchError(process, context: error.localizedDescription)
184+
}
179185

180186
let output = try await outputTask
181187

0 commit comments

Comments
 (0)