diff options
author | Arthur Sengileyev <arthur.sengileyev@gmail.com> | 2022-08-16 13:39:02 +0300 |
---|---|---|
committer | Arthur Sengileyev <arthur.sengileyev@gmail.com> | 2022-08-29 16:53:42 +0300 |
commit | c1480b39a9e993aaa74caabf6d5c8bb865b78784 (patch) | |
tree | de4ca58d0bd8ff2d327a544a775f367ed2ad8597 /pkg/machine/wsl | |
parent | 00b03db6f208614d7967f5dbd5c0281cc0bd6d23 (diff) | |
download | podman-c1480b39a9e993aaa74caabf6d5c8bb865b78784.tar.gz podman-c1480b39a9e993aaa74caabf6d5c8bb865b78784.tar.bz2 podman-c1480b39a9e993aaa74caabf6d5c8bb865b78784.zip |
Improved Windows compatibility for machine command
Signed-off-by: Arthur Sengileyev <arthur.sengileyev@gmail.com>
Diffstat (limited to 'pkg/machine/wsl')
-rw-r--r-- | pkg/machine/wsl/machine.go | 2 | ||||
-rw-r--r-- | pkg/machine/wsl/util_windows.go | 12 |
2 files changed, 1 insertions, 13 deletions
diff --git a/pkg/machine/wsl/machine.go b/pkg/machine/wsl/machine.go index 8f6ef7a43..b89e2f720 100644 --- a/pkg/machine/wsl/machine.go +++ b/pkg/machine/wsl/machine.go @@ -1063,7 +1063,7 @@ func launchWinProxy(v *MachineVM) (bool, string, error) { } return globalName, pipePrefix + waitPipe, waitPipeExists(waitPipe, 30, func() error { - active, exitCode := getProcessState(cmd.Process.Pid) + active, exitCode := machine.GetProcessState(cmd.Process.Pid) if !active { return fmt.Errorf("win-sshproxy.exe failed to start, exit code: %d (see windows event logs)", exitCode) } diff --git a/pkg/machine/wsl/util_windows.go b/pkg/machine/wsl/util_windows.go index 43f54fdd4..6c74e5652 100644 --- a/pkg/machine/wsl/util_windows.go +++ b/pkg/machine/wsl/util_windows.go @@ -280,18 +280,6 @@ func obtainShutdownPrivilege() error { return nil } -func getProcessState(pid int) (active bool, exitCode int) { - const da = syscall.STANDARD_RIGHTS_READ | syscall.PROCESS_QUERY_INFORMATION | syscall.SYNCHRONIZE - handle, err := syscall.OpenProcess(da, false, uint32(pid)) - if err != nil { - return false, int(syscall.ERROR_PROC_NOT_FOUND) - } - - var code uint32 - syscall.GetExitCodeProcess(handle, &code) - return code == 259, int(code) -} - func addRunOnceRegistryEntry(command string) error { k, _, err := registry.CreateKey(registry.CURRENT_USER, `Software\Microsoft\Windows\CurrentVersion\RunOnce`, registry.WRITE) if err != nil { |