Fix the pid-file option for runc run/exec/create command

Signed-off-by: Wang Long <long.wanglong@huawei.com>
This commit is contained in:
Wang Long
2016-11-01 19:13:49 +08:00
parent bc462c96bf
commit 8676c75442
7 changed files with 106 additions and 0 deletions
+20
View File
@@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"path/filepath"
"github.com/Sirupsen/logrus"
"github.com/opencontainers/runtime-spec/specs-go"
@@ -39,3 +40,22 @@ func setupSpec(context *cli.Context) (*specs.Spec, error) {
}
return spec, nil
}
func revisePidFile(context *cli.Context) error {
pidFile := context.String("pid-file")
if pidFile == "" {
return nil
}
// convert pid-file to an absolute path so we can write to the right
// file after chdir to bundle
pidFile, err := filepath.Abs(pidFile)
if err != nil {
return err
}
err = context.Set("pid-file", pidFile)
if err != nil {
return err
}
return nil
}