Change Exited/Status to SetExited/ExitStatus
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
a2a3451925
commit
9f08965699
@ -76,7 +76,7 @@ func (e *execProcess) Pid() int {
|
|||||||
return e.pid
|
return e.pid
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *execProcess) Status() int {
|
func (e *execProcess) ExitStatus() int {
|
||||||
return e.status
|
return e.status
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ func (e *execProcess) ExitedAt() time.Time {
|
|||||||
return e.exited
|
return e.exited
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *execProcess) Exited(status int) {
|
func (e *execProcess) SetExited(status int) {
|
||||||
e.status = status
|
e.status = status
|
||||||
e.exited = time.Now()
|
e.exited = time.Now()
|
||||||
e.parent.platform.shutdownConsole(context.Background(), e.console)
|
e.parent.platform.shutdownConsole(context.Background(), e.console)
|
||||||
|
@ -201,7 +201,7 @@ func (p *initProcess) Pid() int {
|
|||||||
return p.pid
|
return p.pid
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *initProcess) Status() int {
|
func (p *initProcess) ExitStatus() int {
|
||||||
return p.status
|
return p.status
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ func (p *initProcess) Start(context context.Context) error {
|
|||||||
return p.runtimeError(err, "OCI runtime start failed")
|
return p.runtimeError(err, "OCI runtime start failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *initProcess) Exited(status int) {
|
func (p *initProcess) SetExited(status int) {
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
p.status = status
|
p.status = status
|
||||||
p.exited = time.Now()
|
p.exited = time.Now()
|
||||||
|
@ -24,10 +24,10 @@ type process interface {
|
|||||||
Pid() int
|
Pid() int
|
||||||
// Resize resizes the process console
|
// Resize resizes the process console
|
||||||
Resize(ws console.WinSize) error
|
Resize(ws console.WinSize) error
|
||||||
// Exited sets the exit status for the process
|
// SetExited sets the exit status for the process
|
||||||
Exited(status int)
|
SetExited(status int)
|
||||||
// Status returns the exit status
|
// ExitStatus returns the exit status
|
||||||
Status() int
|
ExitStatus() int
|
||||||
// ExitedAt is the time the process exited
|
// ExitedAt is the time the process exited
|
||||||
ExitedAt() time.Time
|
ExitedAt() time.Time
|
||||||
// Delete deletes the process and its resourcess
|
// Delete deletes the process and its resourcess
|
||||||
|
@ -152,12 +152,12 @@ func (s *Service) Delete(ctx context.Context, r *google_protobuf.Empty) (*shimap
|
|||||||
s.mu.Unlock()
|
s.mu.Unlock()
|
||||||
s.events <- &eventsapi.TaskDelete{
|
s.events <- &eventsapi.TaskDelete{
|
||||||
ContainerID: s.id,
|
ContainerID: s.id,
|
||||||
ExitStatus: uint32(p.Status()),
|
ExitStatus: uint32(p.ExitStatus()),
|
||||||
ExitedAt: p.ExitedAt(),
|
ExitedAt: p.ExitedAt(),
|
||||||
Pid: uint32(p.Pid()),
|
Pid: uint32(p.Pid()),
|
||||||
}
|
}
|
||||||
return &shimapi.DeleteResponse{
|
return &shimapi.DeleteResponse{
|
||||||
ExitStatus: uint32(p.Status()),
|
ExitStatus: uint32(p.ExitStatus()),
|
||||||
ExitedAt: p.ExitedAt(),
|
ExitedAt: p.ExitedAt(),
|
||||||
Pid: uint32(p.Pid()),
|
Pid: uint32(p.Pid()),
|
||||||
}, nil
|
}, nil
|
||||||
@ -182,7 +182,7 @@ func (s *Service) DeleteProcess(ctx context.Context, r *shimapi.DeleteProcessReq
|
|||||||
delete(s.processes, p.ID())
|
delete(s.processes, p.ID())
|
||||||
s.mu.Unlock()
|
s.mu.Unlock()
|
||||||
return &shimapi.DeleteResponse{
|
return &shimapi.DeleteResponse{
|
||||||
ExitStatus: uint32(p.Status()),
|
ExitStatus: uint32(p.ExitStatus()),
|
||||||
ExitedAt: p.ExitedAt(),
|
ExitedAt: p.ExitedAt(),
|
||||||
Pid: uint32(p.Pid()),
|
Pid: uint32(p.Pid()),
|
||||||
}, nil
|
}, nil
|
||||||
@ -362,7 +362,7 @@ func (s *Service) Update(ctx context.Context, r *shimapi.UpdateTaskRequest) (*go
|
|||||||
|
|
||||||
func (s *Service) waitExit(p process, pid int, cmd *reaper.Cmd) {
|
func (s *Service) waitExit(p process, pid int, cmd *reaper.Cmd) {
|
||||||
status := <-cmd.ExitCh
|
status := <-cmd.ExitCh
|
||||||
p.Exited(status)
|
p.SetExited(status)
|
||||||
|
|
||||||
reaper.Default.Delete(pid)
|
reaper.Default.Delete(pid)
|
||||||
s.events <- &eventsapi.TaskExit{
|
s.events <- &eventsapi.TaskExit{
|
||||||
|
Loading…
Reference in New Issue
Block a user