Skip to content

Commit

Permalink
utmctl: fix crash from utmctl help attach
Browse files Browse the repository at this point in the history
Indicate to the user that the "attach" command is not yet working.

Fixes #4817
  • Loading branch information
osy committed Dec 28, 2022
1 parent 057383c commit fcae691
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions utmctl/UTMCtl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,7 @@ extension UTMCtl {
let vm = try virtualMachine(forIdentifier: identifer, in: application)
vm.startSaving!(!disposible)
if attach {
var attachCommand = Attach()
attachCommand.environment = environment
attachCommand.identifer = identifer
try attachCommand.run(with: application)
print("WARNING: attach command is not implemented yet!")
}
}
}
Expand Down Expand Up @@ -306,12 +303,6 @@ extension UTMCtl {
@Option(help: "Index of the serial device to attach to.")
var index: Int?

init() {
self.environment = EnvironmentOptions()
self.identifer = VMIdentifier()
self.index = nil
}

func run(with application: UTMScriptingApplication) throws {
let vm = try virtualMachine(forIdentifier: identifer, in: application)
guard let serialPorts = vm.serialPorts!() as? [UTMScriptingSerialPort] else {
Expand All @@ -323,6 +314,7 @@ extension UTMCtl {
continue
}
}
print("WARNING: attach command is not implemented yet!")
if let interface = serialPort.interface, interface != .unavailable {
printResponse(serialPort)
return
Expand Down

0 comments on commit fcae691

Please sign in to comment.