Skip to content

Commit 199cded

Browse files
authored
Merge pull request #26 from alantmiller/fix/vision-async-dispatch
Tested and verified on macOS 26 — vision OCR works correctly after the fix. Thanks for the clean PR and thorough root cause analysis!
2 parents 7f4b7e7 + 04566f0 commit 199cded

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

Sources/MacLocalAPI/main.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,22 @@ if CommandLine.arguments.count > 1 && CommandLine.arguments[1] == "mlx" {
637637
} else if CommandLine.arguments.count > 1 && CommandLine.arguments[1] == "vision" {
638638
let args = Array(CommandLine.arguments.dropFirst(2))
639639
do {
640-
var cmd = try VisionCommand.parseAsRoot(args)
641-
try cmd.run()
640+
let cmd = try VisionCommand.parse(args)
641+
let group = DispatchGroup()
642+
var caughtError: Error?
643+
group.enter()
644+
Task {
645+
do {
646+
try await cmd.run()
647+
} catch {
648+
caughtError = error
649+
}
650+
group.leave()
651+
}
652+
group.wait()
653+
if let error = caughtError {
654+
throw error
655+
}
642656
} catch {
643657
VisionCommand.exit(withError: error)
644658
}

0 commit comments

Comments
 (0)