mirror of
https://git.mills.io/saltyim/saltyim.git
synced 2024-07-01 03:01:09 +00:00
![James Mills](/assets/img/avatar_default.png)
Co-authored-by: James Mills <prologic@shortcircuit.net.au> Reviewed-on: https://git.mills.io/prologic/saltyim/pulls/38
47 lines
764 B
Go
47 lines
764 B
Go
package exec
|
|
|
|
import (
|
|
"fmt"
|
|
"syscall"
|
|
)
|
|
|
|
type ErrCommandKilled struct {
|
|
Err error
|
|
Signal syscall.Signal
|
|
}
|
|
|
|
func (e *ErrCommandKilled) Is(target error) bool {
|
|
if _, ok := target.(*ErrCommandKilled); ok {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (e *ErrCommandKilled) Error() string {
|
|
return fmt.Sprintf("error: command killed: %s", e.Err)
|
|
}
|
|
|
|
func (e *ErrCommandKilled) Unwrap() error {
|
|
return e.Err
|
|
}
|
|
|
|
type ErrCommandFailed struct {
|
|
Err error
|
|
Status int
|
|
}
|
|
|
|
func (e *ErrCommandFailed) Is(target error) bool {
|
|
if _, ok := target.(*ErrCommandFailed); ok {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (e *ErrCommandFailed) Error() string {
|
|
return fmt.Sprintf("error: command failed: %s", e.Err)
|
|
}
|
|
|
|
func (e *ErrCommandFailed) Unwrap() error {
|
|
return e.Err
|
|
}
|