Add detach and pid-file to restore

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2016-02-01 15:00:09 -08:00
parent 92ab7309d5
commit fbc74c0eba
5 changed files with 111 additions and 86 deletions
+6 -3
View File
@@ -9,6 +9,7 @@ import (
"path"
"strconv"
"strings"
"syscall"
"github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
@@ -72,13 +73,13 @@ func execProcess(context *cli.Context) (int, error) {
}
var (
detach = context.Bool("detach")
bundle = container.Config().Rootfs
rootfs = container.Config().Rootfs
)
rootuid, err := container.Config().HostUID()
if err != nil {
return -1, err
}
p, err := getProcess(context, path.Dir(bundle))
p, err := getProcess(context, path.Dir(rootfs))
if err != nil {
return -1, err
}
@@ -91,7 +92,9 @@ func execProcess(context *cli.Context) (int, error) {
return -1, err
}
if pidFile := context.String("pid-file"); pidFile != "" {
if err := createPidile(pidFile, process); err != nil {
if err := createPidFile(pidFile, process); err != nil {
process.Signal(syscall.SIGKILL)
process.Wait()
return -1, err
}
}