// ExecSync runs a command in a container synchronously.
ExecSync runs a command in a container synchronously.
// ExecSync runs a command in a container synchronously .
func (p *PrivilegedRuntime) ExecSync(containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error) {
	request := &kubeapi.ExecSyncRequest{
		ContainerId: containerID,
		Cmd:         cmd,
		Timeout:     int64(timeout),
	}
	logrus.Debugf("ExecSyncRequest: %v", request)
	r, err := runtimeClient.ExecSync(context.Background(), request)
	logrus.Debugf("ExecSyncResponse: %v", r)
	if err != nil {
		return nil, nil, err
	}
	if r.ExitCode != 0 {
		fmt.Printf("Exit code: %v\n", r.ExitCode)
	}
	return r.Stdout, r.Stderr, nil
}
func ( p * PrivilegedRuntime ) ExecSync ( containerID string , cmd [ ] string , timeout time . Duration ) ( stdout [ ] byte , stderr [ ] byte , err error ) { request := & kubeapi . ExecSyncRequest { ContainerId : containerID , Cmd : cmd , Timeout : int64 ( timeout ) , } logrus . Debugf ( " " , request ) r , err := runtimeClient . ExecSync ( context . Background ( ) , request ) logrus . Debugf ( " " , r ) if err != nil { return nil , nil , err } if r . ExitCode != 0 { fmt . Printf ( " \n " , r . ExitCode ) } return r . Stdout , r . Stderr , nil }
ExecSync runs a command in a container synchronously.
ExecSync runs a command in a container synchronously .