mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
Add nil check for process
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
3dde768894
commit
09f126691c
@ -49,6 +49,10 @@ func execCommand(program string, args ...string) (stdout, stderr []byte, err err
|
||||
klog.V(4).Infof("cephfs: EXEC %s %s", program, sanitizedArgs)
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
if cmd.Process == nil {
|
||||
return nil, nil, fmt.Errorf("cannot get process pid while running %s %v: %v: %s",
|
||||
program, sanitizedArgs, err, stderrBuf.Bytes())
|
||||
}
|
||||
return nil, nil, fmt.Errorf("an error occurred while running (%d) %s %v: %v: %s",
|
||||
cmd.Process.Pid, program, sanitizedArgs, err, stderrBuf.Bytes())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user