mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user