From d67666ab1befd82abd618786debb101f047ad9c1 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 2 Oct 2025 13:07:56 -0700 Subject: [PATCH] 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. --- Sources/SWBUtil/Process.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/SWBUtil/Process.swift b/Sources/SWBUtil/Process.swift index 7f119cc6..0c696dca 100644 --- a/Sources/SWBUtil/Process.swift +++ b/Sources/SWBUtil/Process.swift @@ -175,7 +175,13 @@ extension Process { async let outputTask = await collect(streams) - try await process.run(interruptible: interruptible) + do { + try await process.run(interruptible: interruptible) + } catch is CancellationError { + throw CancellationError() + } catch { + throw try RunProcessLaunchError(process, context: error.localizedDescription) + } let output = try await outputTask