Setup the server as subreaper for child processes

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
Mrunal Patel 2016-08-01 16:50:45 -07:00
parent 7c5fccd7a8
commit fc3b7b5aae

View file

@ -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