libvmz: return errors from vmz_request_stop #28

Open
opened 2026-05-22 10:37:59 +00:00 by rc · 0 comments
Owner

Problem:

  • vmz_request_stop returns void and suppresses any Swift error with try?.
  • Callers cannot know whether the graceful stop request was accepted, rejected, or invalid for the VM state.

Why this is bad:

  • Silent failure makes shutdown behavior hard to diagnose.
  • Callers may assume the guest is stopping when no request was actually accepted.
  • This differs from the rest of the API, which at least tries to surface VMZErrorRef failures.

Suggested fix:

  • Return a VMZStatus or bool from vmz_request_stop.
  • Accept VMZErrorRef * or another error output for details.
  • Report bad handle/state and Virtualization.framework requestStop errors.

Relevant code:

  • lib/libvmz.h: vmz_request_stop returns void and documents possible silent failure.
  • lib/libvmz.swift: swift_vm_request_stop uses try? engine.vm.requestStop().
Problem: - vmz_request_stop returns void and suppresses any Swift error with try?. - Callers cannot know whether the graceful stop request was accepted, rejected, or invalid for the VM state. Why this is bad: - Silent failure makes shutdown behavior hard to diagnose. - Callers may assume the guest is stopping when no request was actually accepted. - This differs from the rest of the API, which at least tries to surface VMZErrorRef failures. Suggested fix: - Return a VMZStatus or bool from vmz_request_stop. - Accept VMZErrorRef * or another error output for details. - Report bad handle/state and Virtualization.framework requestStop errors. Relevant code: - lib/libvmz.h: vmz_request_stop returns void and documents possible silent failure. - lib/libvmz.swift: swift_vm_request_stop uses try? engine.vm.requestStop().
Sign in to join this conversation.
No labels
highprio
lowprio
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rc/vmz#28
No description provided.