lima-vm / lima

Linux virtual machines, with a focus on running containers
https://lima-vm.io/
Apache License 2.0
15.07k stars 591 forks source link

Make it possible to call instance.Start() from another program #2658

Closed jandubois closed 2 hours ago

jandubois commented 2 days ago

instance.Start runs the host-agent as a subprocess using limactl. This code currently only works when it is invoked by limactl itself. Adding a parameter to allow a caller to pass in the path to the limactl binary to use.

The tail.Cleanup function prevents the process from tailing the same file again (at least on macOS), which breaks instance.Stop because it can no longer receive the exited event by tailing ha.stdout.log.

A hint has been added to the module docs (without further context or explanation) in https://github.com/nxadm/tail/commit/2efc79c:

If you plan to re-read a file, don't call Cleanup in between.

Eventually I would like to be able to (optionally) also run the host-agent in-process and not rely on tailing a log file for IPC, but that is a bigger change for another time.


PS: I think in this case the 2 commits shouldn't be squashed, as they have a common purpose, but address separate issues. It just feels like overkill to create a separate PR just to remove the 2 Cleanup calls.