Skip to content

Dead code? #51

Description

@grembo

It seems like nothing in nomad really calls this code - but since I'm no golang hero in any respect, I figured it's better to ask than to axe:

// shutdown shuts down the container, with `timeout` grace period
// before killing the container with SIGKILL.
func (h *taskHandle) shutdown(timeout time.Duration) error {
// Wait for the process to finish or kill it after a timeout (whichever happens first):
var fixTimeOut time.Duration
fixTimeOut = 5 * time.Second
h.procState = drivers.TaskStateExited
done := make(chan error, 1)
go func() {
done <- h.syexec.cmd.Wait()
}()
select {
case <-time.After(fixTimeOut * time.Second):
if err := h.syexec.cmd.Process.Kill(); err != nil {
return fmt.Errorf("failed to kill process: %v ", err)
}
case err := <-done:
if err != nil {
return fmt.Errorf("process finished with error = %v", err)
}
}
return nil
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions