Files
podman/pkg/machine/gvproxy_windows.go
Jason T. Greene 487219d809 Complete WSL implementation, refactor a few areas
Also addresses a number of issues:
- StopHostNetworking isn't plumbed, win-sshproxy leaks on hyperv
- Wait api and print output doesn't work properly on Windows
- API forwarding doesn't work on WSL
- Terminal corruption with after start/stop on Windows
- Gvproxy is forcefully killed vs gracefully quit
- Switching rootful/rootless does not update /var/run/docker.sock on the guest
- File already closed error on init
- HyperV backend is publishing Unix sockets when it should be named pipes
- User-mode networking doesn't always work
- Stop state outside of lock boundaries
- WSL blocks parallel machined (should be supported)

[NO NEW TESTS NEEDED]

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2024-02-11 12:58:11 -06:00

43 lines
891 B
Go

package machine
import (
"os"
"time"
"github.com/containers/winquit/pkg/winquit"
"github.com/sirupsen/logrus"
)
func waitOnProcess(processID int) error {
logrus.Infof("Going to stop gvproxy (PID %d)", processID)
p, err := os.FindProcess(processID)
if err != nil {
return nil
}
// Gracefully quit and force kill after 30 seconds
if err := winquit.QuitProcess(processID, 30*time.Second); err != nil {
return err
}
logrus.Debugf("completed grace quit || kill of gvproxy (PID %d)", processID)
// Make sure the process is gone
done := make(chan struct{})
go func() {
_, _ = p.Wait()
done <- struct{}{}
}()
select {
case <-done:
logrus.Debugf("verified gvproxy termination (PID %d)", processID)
case <-time.After(10 * time.Second):
// Very unlikely but track just in case
logrus.Errorf("was not able to kill gvproxy (PID %d)", processID)
}
return nil
}