Add --pid-file to ctr

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2018-02-20 15:10:50 -05:00
parent 129167132c
commit d3a8055e2d
3 changed files with 38 additions and 1 deletions

View File

@@ -38,6 +38,10 @@ var startCommand = cli.Command{
Name: "fifo-dir",
Usage: "directory used for storing IO FIFOs",
},
cli.StringFlag{
Name: "pid-file",
Usage: "file path to write the task's pid",
},
},
Action: func(context *cli.Context) error {
var (
@@ -72,7 +76,11 @@ var startCommand = cli.Command{
return err
}
defer task.Delete(ctx)
if context.IsSet("pid-file") {
if err := commands.WritePidFile(context.String("pid-file"), int(task.Pid())); err != nil {
return err
}
}
statusC, err := task.Wait(ctx)
if err != nil {
return err