summaryrefslogtreecommitdiff
path: root/pkg/machine/wsl
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/machine/wsl')
-rw-r--r--pkg/machine/wsl/machine.go2
-rw-r--r--pkg/machine/wsl/util_windows.go12
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 {