execsync: return proper error description
The gprc execsync client call doesn't populate `ExecSyncResponse` on error at all. You just get an error. This patch modifies the code to include command's streams, exit code and error direcly into the error. `ocic` will then print useful infomation in the cli, otherwise it won't. Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
2e3ad167bb
commit
cbe2a68ce5
3 changed files with 79 additions and 29 deletions
|
@ -32,6 +32,9 @@ func (s *Server) ExecSync(ctx context.Context, req *pb.ExecSyncRequest) (*pb.Exe
|
|||
}
|
||||
|
||||
execResp, err := s.runtime.ExecSync(c, cmd, req.GetTimeout())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := &pb.ExecSyncResponse{
|
||||
Stdout: execResp.Stdout,
|
||||
Stderr: execResp.Stderr,
|
||||
|
@ -39,5 +42,5 @@ func (s *Server) ExecSync(ctx context.Context, req *pb.ExecSyncRequest) (*pb.Exe
|
|||
}
|
||||
|
||||
logrus.Debugf("ExecSyncResponse: %+v", resp)
|
||||
return resp, err
|
||||
return resp, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue