feat: support task cancellation

This commit is contained in:
Gareth George
2023-12-20 08:54:45 +00:00
parent 95ca96a31f
commit fc9c06df00
15 changed files with 366 additions and 74 deletions

View File

@@ -16,7 +16,7 @@ type CmdError struct {
func (e *CmdError) Error() string {
m := fmt.Sprintf("command %q failed: %s", e.Command, e.Err.Error())
if e.Output != "" {
m += "\nDetails: \n" + e.Output
m += "\nProcess STDOUT: \n" + e.Output
}
return m
}
@@ -35,6 +35,7 @@ func newCmdError(cmd *exec.Cmd, output string, err error) *CmdError {
cerr := &CmdError{
Command: cmd.String(),
Err: err,
Output: output,
}
if len(output) >= outputBufferLimit {
@@ -48,5 +49,6 @@ func newCmdErrorPreformatted(cmd *exec.Cmd, output string, err error) *CmdError
return &CmdError{
Command: cmd.String(),
Err: err,
Output: output,
}
}