cio: add WithFIFODir opt

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2018-01-16 18:49:05 +09:00
parent bbb5b2f15e
commit 507a149488
8 changed files with 50 additions and 15 deletions

View File

@@ -28,6 +28,10 @@ var execCommand = cli.Command{
Name: "exec-id",
Usage: "exec specific id for the process",
},
cli.StringFlag{
Name: "fifo-dir",
Usage: "directory used for storing IO FIFOs",
},
},
Action: func(context *cli.Context) error {
var (
@@ -60,10 +64,11 @@ var execCommand = cli.Command{
pspec.Terminal = tty
pspec.Args = args
ioCreator := cio.NewCreator(cio.WithStdio)
cioOpts := []cio.Opt{cio.WithStdio, cio.WithFIFODir(context.String("fifo-dir"))}
if tty {
ioCreator = cio.NewCreator(cio.WithStdio, cio.WithTerminal)
cioOpts = append(cioOpts, cio.WithTerminal)
}
ioCreator := cio.NewCreator(cioOpts...)
process, err := task.Exec(ctx, context.String("exec-id"), pspec, ioCreator)
if err != nil {
return err