CLIHandler --debug: defer { logProcess?.terminate() } may crash on exit if /usr/bin/log failed to launch. (Severity: nit.)
Root cause
In handleTranscribe(_:) (TranscriberApp/Services/CLIHandler.swift:64-78):
let proc = Process()
proc.executableURL = URL(fileURLWithPath: "/usr/bin/log")
try? proc.run() // swallows launch error
logProcess = proc // unconditional assignment
...
defer { logProcess?.terminate() }
If proc.run() throws, logProcess holds a never-launched Process. Process.terminate() on an unlaunched task raises an Objective-C NSInvalidArgumentException ("task not launched"), which Swift cannot catch → SIGABRT (exit 134) on exit, after transcription output was already written.
Impact
Narrow trigger — /usr/bin/log is standard on macOS, app is non-sandboxed. Fires only in hardened/sandboxed test harnesses, corrupted installs, or transient fork/exec failures. No data loss (crash is in the exit defer). Filed as nit.
Fix (smallest diff)
Guard the defer:
defer { if logProcess?.isRunning == true { logProcess?.terminate() } }
or only assign logProcess = proc inside a do { try proc.run(); logProcess = proc } catch { ... }.
Found by ultrareview of PR #46 (bug_001).
CLIHandler --debug:defer { logProcess?.terminate() }may crash on exit if/usr/bin/logfailed to launch. (Severity: nit.)Root cause
In
handleTranscribe(_:)(TranscriberApp/Services/CLIHandler.swift:64-78):If
proc.run()throws,logProcessholds a never-launchedProcess.Process.terminate()on an unlaunched task raises an Objective-CNSInvalidArgumentException("task not launched"), which Swift cannot catch → SIGABRT (exit 134) on exit, after transcription output was already written.Impact
Narrow trigger —
/usr/bin/logis standard on macOS, app is non-sandboxed. Fires only in hardened/sandboxed test harnesses, corrupted installs, or transientfork/execfailures. No data loss (crash is in the exitdefer). Filed as nit.Fix (smallest diff)
Guard the defer:
or only assign
logProcess = procinside ado { try proc.run(); logProcess = proc } catch { ... }.Found by ultrareview of PR #46 (bug_001).