mirror of
https://github.com/MCKero6423/uv-k5-v3-emulator.git
synced 2026-10-02 11:07:31 +00:00
Power on/off cannot live inside the QMP connection: QMP quit destroys the socket a later power on would have to arrive through. So something outside it has to be able to spawn the process again. Off then On is a cold boot -- process replaced, guest from reset -- which is the behaviour asked for: like cutting mains power and restoring it. system_reset is the warm alternative and keeps the process. adopt() is for attaching to a run.sh instance. power_off then refuses, because we did not start that process. is_running() also reports False for a process that exited on its own, rather than trusting our own bookkeeping. power_off tolerates quit raising: the socket usually drops before the reply arrives, so that is success rather than an error. The launcher clears a stale socket first, since QEMU failing to bind presents as On doing nothing. Verified against real QEMU: starts with 0 processes, On gives 1, Reset keeps the same one, Off returns to 0, On again cold boots. 14 unit tests with a fake launcher, so they need no emulator.