Remove detach for exec options

Detachable exec commands are handled in the client entirely and the detach option is not used anymore.

PiperOrigin-RevId: 195181272
Change-Id: I6e82a2876d2c173709c099be59670f71702e5bf0
This commit is contained in:
Fabricio Voznika
2018-05-02 17:40:01 -07:00
committed by Shentubot
parent 6c061ad913
commit a61def1b36
3 changed files with 2 additions and 18 deletions
-9
View File
@@ -72,9 +72,6 @@ type ExecArgs struct {
// Capabilities is the list of capabilities to give to the process.
Capabilities *auth.TaskCapabilities
// Detach indicates whether Exec should detach once the process starts.
Detach bool
// FilePayload determines the files to give to the new process.
urpc.FilePayload
}
@@ -135,12 +132,6 @@ func (proc *Proc) Exec(args *ExecArgs, waitStatus *uint32) error {
return err
}
// If we're supposed to detach, don't wait for the process to exit.
if args.Detach {
*waitStatus = 0
return nil
}
// Wait for completion.
newTG.WaitExited()
*waitStatus = newTG.ExitStatus().Status()
+1 -2
View File
@@ -99,7 +99,6 @@ func (ex *Exec) Execute(_ context.Context, f *flag.FlagSet, args ...interface{})
if err != nil {
Fatalf("error parsing process spec: %v", err)
}
e.Detach = ex.detach
conf := args[0].(*boot.Config)
waitStatus := args[1].(*syscall.WaitStatus)
@@ -123,7 +122,7 @@ func (ex *Exec) Execute(_ context.Context, f *flag.FlagSet, args ...interface{})
// executed. If detach was specified, starts a child in non-detach mode,
// write the child's PID to the pid file. So when the container returns, the
// child process will also return and signal containerd.
if e.Detach {
if ex.detach {
binPath, err := specutils.BinPath()
if err != nil {
Fatalf("error getting bin path: %v", err)
+1 -7
View File
@@ -365,7 +365,6 @@ func TestExec(t *testing.T) {
Envv: []string{"PATH=" + os.Getenv("PATH")},
WorkingDirectory: "/",
KUID: uid,
Detach: false,
}
// Verify that "sleep 100" and "sleep 5" are running after exec.
@@ -472,7 +471,6 @@ func TestCapabilities(t *testing.T) {
KUID: uid,
KGID: gid,
Capabilities: &auth.TaskCapabilities{},
Detach: true,
}
// "exe" should fail because we don't have the necessary permissions.
@@ -484,14 +482,10 @@ func TestCapabilities(t *testing.T) {
execArgs.Capabilities = &auth.TaskCapabilities{
EffectiveCaps: auth.CapabilitySetOf(linux.CAP_DAC_OVERRIDE),
}
// First, start running exec.
// "exe" should not fail this time.
if _, err := s.Execute(&execArgs); err != nil {
t.Fatalf("sandbox failed to exec %v: %v", execArgs, err)
}
if err := waitForProcessList(s, expectedPL); err != nil {
t.Error(err)
}
}
// Test that an tty FD is sent over the console socket if one is provided.