From fc3b7b5aae585b484dde151911e5b6abd4845954 Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Mon, 1 Aug 2016 16:50:45 -0700 Subject: [PATCH] Setup the server as subreaper for child processes Signed-off-by: Mrunal Patel --- server/server.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/server.go b/server/server.go index d4e60817..b1faf80e 100644 --- a/server/server.go +++ b/server/server.go @@ -1,7 +1,10 @@ package server import ( + "fmt" + "github.com/mrunalp/ocid/oci" + "github.com/mrunalp/ocid/utils" ) const ( @@ -17,6 +20,12 @@ type Server struct { // New creates a new Server with options provided func New(runtimePath, sandboxDir, containerDir string) (*Server, error) { + // TODO: This will go away later when we have wrapper process or systemd acting as + // subreaper. + if err := utils.SetSubreaper(1); err != nil { + return nil, fmt.Errorf("failed to set server as subreaper: %v", err) + } + r, err := oci.New(runtimePath, containerDir) if err != nil { return nil, err