Browse code

Shutdown instead of terminate process on Windows

Signed-off-by: Darren Stahl <darst@microsoft.com>

Darren Stahl authored on 2016/10/19 08:13:00
Showing 1 changed files
... ...
@@ -15,7 +15,7 @@ import (
15 15
 	"github.com/Microsoft/hcsshim"
16 16
 	"github.com/Sirupsen/logrus"
17 17
 	"github.com/docker/docker/pkg/sysinfo"
18
-	"github.com/opencontainers/runtime-spec/specs-go"
18
+	specs "github.com/opencontainers/runtime-spec/specs-go"
19 19
 )
20 20
 
21 21
 type client struct {
... ...
@@ -396,10 +396,12 @@ func (clnt *client) Signal(containerID string, sig int) error {
396 396
 			}
397 397
 		}
398 398
 	} else {
399
-		// Terminate Process
400
-		if err := cont.hcsProcess.Kill(); err != nil && !hcsshim.IsAlreadyStopped(err) {
401
-			// ignore errors
402
-			logrus.Warnf("libcontainerd: failed to terminate pid %d in %s: %q", cont.systemPid, containerID, err)
399
+		// Shut down the container
400
+		if err := cont.hcsContainer.Shutdown(); err != nil {
401
+			if !hcsshim.IsPending(err) && !hcsshim.IsAlreadyStopped(err) {
402
+				// ignore errors
403
+				logrus.Warnf("libcontainerd: failed to shutdown container %s: %q", containerID, err)
404
+			}
403 405
 		}
404 406
 	}
405 407