diff --git a/libcontainerd/client_windows.go b/libcontainerd/client_windows.go index 5e545384b2..0a1e48f656 100644 --- a/libcontainerd/client_windows.go +++ b/libcontainerd/client_windows.go @@ -224,11 +224,6 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly } pid := newProcess.Pid() - openedProcess, err := container.hcsContainer.OpenProcess(pid) - if err != nil { - logrus.Errorf("AddProcess %s OpenProcess() failed %s", containerID, err) - return err - } stdin, stdout, stderr, err = newProcess.Stdio() if err != nil { @@ -255,7 +250,7 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly systemPid: uint32(pid), }, commandLine: createProcessParms.CommandLine, - hcsProcess: openedProcess, + hcsProcess: newProcess, } // Add the process to the container's list of processes diff --git a/libcontainerd/container_windows.go b/libcontainerd/container_windows.go index 6e5f02565e..d7c80f3e82 100644 --- a/libcontainerd/container_windows.go +++ b/libcontainerd/container_windows.go @@ -93,20 +93,10 @@ func (ctr *container) start() error { ctr.startedAt = time.Now() pid := newProcess.Pid() - openedProcess, err := ctr.hcsContainer.OpenProcess(pid) - if err != nil { - logrus.Errorf("OpenProcess() failed %s", err) - if err := ctr.terminate(); err != nil { - logrus.Errorf("Failed to cleanup after a failed OpenProcess. %s", err) - } else { - logrus.Debugln("Cleaned up after failed OpenProcess by calling Terminate") - } - return err - } // Save the hcs Process and PID ctr.process.friendlyName = InitFriendlyName - ctr.process.hcsProcess = openedProcess + ctr.process.hcsProcess = newProcess // If this is a servicing container, wait on the process synchronously here and // if it succeeds, wait for it cleanly shutdown and merge into the parent container. diff --git a/libcontainerd/process_windows.go b/libcontainerd/process_windows.go index 038cbde0ec..c18dab3ff7 100644 --- a/libcontainerd/process_windows.go +++ b/libcontainerd/process_windows.go @@ -47,6 +47,6 @@ func createStdInCloser(pipe io.WriteCloser, process hcsshim.Process) io.WriteClo } } - return process.Close() + return err }) }