do not pass nil to genericError
currently genericError constructors require not-nil error to be able to read its Error() message Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
This commit is contained in:
parent
025e6be6c5
commit
4ce8d97320
|
@ -206,7 +206,7 @@ func (c *linuxContainer) Destroy() error {
|
|||
return err
|
||||
}
|
||||
if status != Destroyed {
|
||||
return newGenericError(nil, ContainerNotStopped)
|
||||
return newGenericError(fmt.Errorf("container is not destroyed"), ContainerNotStopped)
|
||||
}
|
||||
if !c.config.Namespaces.Contains(configs.NEWPID) {
|
||||
if err := killCgroupProcesses(c.cgroupManager); err != nil {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package libcontainer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
@ -46,7 +47,7 @@ type Process struct {
|
|||
// Wait releases any resources associated with the Process
|
||||
func (p Process) Wait() (*os.ProcessState, error) {
|
||||
if p.ops == nil {
|
||||
return nil, newGenericError(nil, ProcessNotExecuted)
|
||||
return nil, newGenericError(fmt.Errorf("invalid process"), ProcessNotExecuted)
|
||||
}
|
||||
return p.ops.wait()
|
||||
}
|
||||
|
@ -54,7 +55,7 @@ func (p Process) Wait() (*os.ProcessState, error) {
|
|||
// Pid returns the process ID
|
||||
func (p Process) Pid() (int, error) {
|
||||
if p.ops == nil {
|
||||
return -1, newGenericError(nil, ProcessNotExecuted)
|
||||
return -1, newGenericError(fmt.Errorf("invalid process"), ProcessNotExecuted)
|
||||
}
|
||||
return p.ops.pid(), nil
|
||||
}
|
||||
|
@ -62,7 +63,7 @@ func (p Process) Pid() (int, error) {
|
|||
// Signal sends a signal to the Process.
|
||||
func (p Process) Signal(sig os.Signal) error {
|
||||
if p.ops == nil {
|
||||
return newGenericError(nil, ProcessNotExecuted)
|
||||
return newGenericError(fmt.Errorf("invalid process"), ProcessNotExecuted)
|
||||
}
|
||||
return p.ops.signal(sig)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue