summaryrefslogtreecommitdiffhomepage
path: root/runsc/cmd
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-06-18 22:44:13 +0000
committergVisor bot <gvisor-bot@google.com>2019-06-18 22:44:13 +0000
commit32848221a9de1a6fd7fcc4ef4fb881cf8fe2489c (patch)
tree068b3a1c94715832ce3a97a575292051e2948916 /runsc/cmd
parentdfbde70e972d909e0c10d4b85841b908325095be (diff)
parent0e07c94d545aa971bb2a05b738f856181a3ff463 (diff)
Merge 0e07c94d (automated)
Diffstat (limited to 'runsc/cmd')
-rw-r--r--runsc/cmd/do.go20
-rw-r--r--runsc/cmd/restore.go3
-rw-r--r--runsc/cmd/run.go3
3 files changed, 19 insertions, 7 deletions
diff --git a/runsc/cmd/do.go b/runsc/cmd/do.go
index 16d135b51..9a8a49054 100644
--- a/runsc/cmd/do.go
+++ b/runsc/cmd/do.go
@@ -39,9 +39,10 @@ import (
// Do implements subcommands.Command for the "do" command. It sets up a simple
// sandbox and executes the command inside it. See Usage() for more details.
type Do struct {
- root string
- cwd string
- ip string
+ root string
+ cwd string
+ ip string
+ quiet bool
}
// Name implements subcommands.Command.Name.
@@ -71,6 +72,7 @@ func (c *Do) SetFlags(f *flag.FlagSet) {
f.StringVar(&c.root, "root", "/", `path to the root directory, defaults to "/"`)
f.StringVar(&c.cwd, "cwd", ".", "path to the current directory, defaults to the current directory")
f.StringVar(&c.ip, "ip", "192.168.10.2", "IPv4 address for the sandbox")
+ f.BoolVar(&c.quiet, "quiet", false, "suppress runsc messages to stdout. Application output is still sent to stdout and stderr")
}
// Execute implements subcommands.Command.Execute.
@@ -134,7 +136,7 @@ func (c *Do) Execute(_ context.Context, f *flag.FlagSet, args ...interface{}) su
} else if conf.Rootless {
if conf.Network == boot.NetworkSandbox {
- fmt.Println("*** Rootless requires changing network type to host ***")
+ c.notifyUser("*** Warning: using host network due to --rootless ***")
conf.Network = boot.NetworkHost
}
@@ -168,8 +170,9 @@ func (c *Do) Execute(_ context.Context, f *flag.FlagSet, args ...interface{}) su
ID: cid,
Spec: spec,
BundleDir: tmpDir,
+ Attached: true,
}
- ws, err := container.Run(conf, runArgs, false)
+ ws, err := container.Run(conf, runArgs)
if err != nil {
return Errorf("running container: %v", err)
}
@@ -178,6 +181,13 @@ func (c *Do) Execute(_ context.Context, f *flag.FlagSet, args ...interface{}) su
return subcommands.ExitSuccess
}
+func (c *Do) notifyUser(format string, v ...interface{}) {
+ if !c.quiet {
+ fmt.Printf(format+"\n", v...)
+ }
+ log.Warningf(format, v...)
+}
+
func resolvePath(path string) (string, error) {
var err error
path, err = filepath.Abs(path)
diff --git a/runsc/cmd/restore.go b/runsc/cmd/restore.go
index e18910325..7be60cd7d 100644
--- a/runsc/cmd/restore.go
+++ b/runsc/cmd/restore.go
@@ -107,8 +107,9 @@ func (r *Restore) Execute(_ context.Context, f *flag.FlagSet, args ...interface{
ConsoleSocket: r.consoleSocket,
PIDFile: r.pidFile,
UserLog: r.userLog,
+ Attached: !r.detach,
}
- ws, err := container.Run(conf, runArgs, r.detach)
+ ws, err := container.Run(conf, runArgs)
if err != nil {
return Errorf("running container: %v", err)
}
diff --git a/runsc/cmd/run.go b/runsc/cmd/run.go
index ee14dc3d9..33f4bc12b 100644
--- a/runsc/cmd/run.go
+++ b/runsc/cmd/run.go
@@ -88,8 +88,9 @@ func (r *Run) Execute(_ context.Context, f *flag.FlagSet, args ...interface{}) s
ConsoleSocket: r.consoleSocket,
PIDFile: r.pidFile,
UserLog: r.userLog,
+ Attached: !r.detach,
}
- ws, err := container.Run(conf, runArgs, r.detach)
+ ws, err := container.Run(conf, runArgs)
if err != nil {
return Errorf("running container: %v", err)
}