Skip to content

Commit 298cd1b

Browse files
committed
Added error string for process operations
Signed-off-by: rajasec <rajasec79@gmail.com> Changing the error code string name as per review comments Signed-off-by: rajasec <rajasec79@gmail.com>
1 parent 5fe15a5 commit 298cd1b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

libcontainer/error.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const (
1919
ContainerNotPaused
2020

2121
// Process errors
22-
ProcessNotExecuted
22+
NoProcessOps
2323

2424
// Common errors
2525
ConfigInvalid
@@ -49,6 +49,8 @@ func (c ErrorCode) String() string {
4949
return "Console exists for process"
5050
case ContainerNotPaused:
5151
return "Container is not paused"
52+
case NoProcessOps:
53+
return "No process operations"
5254
default:
5355
return "Unknown error"
5456
}

libcontainer/process.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type Process struct {
5555
// Wait releases any resources associated with the Process
5656
func (p Process) Wait() (*os.ProcessState, error) {
5757
if p.ops == nil {
58-
return nil, newGenericError(fmt.Errorf("invalid process"), ProcessNotExecuted)
58+
return nil, newGenericError(fmt.Errorf("invalid process"), NoProcessOps)
5959
}
6060
return p.ops.wait()
6161
}
@@ -65,15 +65,15 @@ func (p Process) Pid() (int, error) {
6565
// math.MinInt32 is returned here, because it's invalid value
6666
// for the kill() system call.
6767
if p.ops == nil {
68-
return math.MinInt32, newGenericError(fmt.Errorf("invalid process"), ProcessNotExecuted)
68+
return math.MinInt32, newGenericError(fmt.Errorf("invalid process"), NoProcessOps)
6969
}
7070
return p.ops.pid(), nil
7171
}
7272

7373
// Signal sends a signal to the Process.
7474
func (p Process) Signal(sig os.Signal) error {
7575
if p.ops == nil {
76-
return newGenericError(fmt.Errorf("invalid process"), ProcessNotExecuted)
76+
return newGenericError(fmt.Errorf("invalid process"), NoProcessOps)
7777
}
7878
return p.ops.signal(sig)
7979
}

0 commit comments

Comments
 (0)