mirror of https://github.com/cirruslabs/tart.git
Fixed --no-graphics (#132)
Followup to #129 which broke CLI integration because `--no-graphics` option didn't wait for anything.
This commit is contained in:
parent
b581db5be4
commit
2020324ef5
|
|
@ -37,9 +37,14 @@ struct Run: AsyncParsableCommand {
|
|||
let vmDir = try VMStorageLocal().open(name)
|
||||
vm = try VM(vmDir: vmDir)
|
||||
|
||||
Task {
|
||||
let runTask = Task {
|
||||
do {
|
||||
try await vm!.run(recovery)
|
||||
|
||||
// wait for VM to be in a final state before exit
|
||||
while !(vm?.inFinalState ?? false) {
|
||||
try await Task.sleep(nanoseconds: 1_000_000)
|
||||
}
|
||||
|
||||
Foundation.exit(0)
|
||||
} catch {
|
||||
|
|
@ -65,12 +70,12 @@ struct Run: AsyncParsableCommand {
|
|||
} catch {
|
||||
print("Failed to get an IP for screen sharing: \(error)")
|
||||
}
|
||||
while !(vm?.inFinalState ?? false) {
|
||||
try await Task.sleep(nanoseconds: 1_000_000)
|
||||
}
|
||||
} else if !noGraphics {
|
||||
runUI()
|
||||
}
|
||||
|
||||
// wait for VM to get into a final state
|
||||
try await runTask.value
|
||||
}
|
||||
|
||||
private func runUI() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue