traderepublic / Cilicon

🛠️ Self-Hosted ephemeral macOS CI on Apple Silicon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VM Startup silently fails on Virtualization error

ast3150 opened this issue · comments

The setupAndRunVirtualMachine() function in VMManager silently fails if an error in the Virtualization framework occurrs.

This is because the try syntax in a Task does not require the code to actually handle the error. (see https://forums.swift.org/t/task-initializer-with-throwing-closure-swallows-error/56066 )

Task { @MainActor in
vmState = .running(virtualMachine)
try await virtualMachine.start()
}

My recommended solution is to run the entire method on @MainActor and just remove the Task altogether.

This can help users debug issues such as this, because important context is provided for debugging:
Screenshot 2023-09-14 at 12 06 52