code: func (r *runtimeOCI) ExecContainer(c *Container, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error {
  	processFile, err := prepareProcessExec(c, cmd, tty)
  	if err != nil {
  		return err
  	}
  	defer os.RemoveAll(processFile.Name())
  
  	args := []string{rootFlag, r.root, "exec"}
  	args = append(args, "--process", processFile.Name())
  	args = append(args, c.ID())
  	execCmd := exec.Command(r.path, args...)
  	if v, found := os.LookupEnv("XDG_RUNTIME_DIR"); found {
  		execCmd.Env = append(execCmd.Env, fmt.Sprintf("XDG_RUNTIME_DIR=%s", v))
  	}
  	var cmdErr error
  	if tty {
  		cmdErr = ttyCmd(execCmd, stdin, stdout, resize)
  	} else {
  		if stdin != nil {
  			// Use an os.Pipe here as it returns true *os.File objects.
  			// This way, if you run 'kubectl exec <pod> -i bash' (no tty) and type 'exit',
  			// the call below to execCmd.Run() can unblock because its Stdin is the read half
  			// of the pipe.
  			r, w, err := os.Pipe()
  			if err != nil {
  				return err
  			}
  			go pools.Copy(w, stdin)
  
  			execCmd.Stdin = r
  		}
  		if stdout != nil {
  			execCmd.Stdout = stdout
  		}
  		if stderr != nil {
  			execCmd.Stderr = stderr
  		}
  
  		cmdErr = execCmd.Run()
  	}
  
  	if exitErr, ok := cmdErr.(*exec.ExitError); ok {
  		return &utilexec.ExitErrorWrapper{ExitError: exitErr}
  	}
  	return cmdErr
  }
docs: // ExecContainer prepares a streaming endpoint to execute a command in the container.