2024-07-04 22:40:13 +02:00
|
|
|
package linux
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
2024-07-06 17:48:45 +02:00
|
|
|
"io"
|
|
|
|
"sync"
|
2024-07-04 22:40:13 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type LinuxCommand struct {
|
2024-07-06 17:48:45 +02:00
|
|
|
Options CommandOptions
|
|
|
|
handlers map[int]interface{}
|
|
|
|
wg sync.WaitGroup
|
|
|
|
stdout io.ReadCloser
|
|
|
|
stderr io.ReadCloser
|
|
|
|
stdin io.WriteCloser
|
2024-07-04 22:40:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type CommandOptions struct {
|
2024-07-05 01:40:33 +02:00
|
|
|
Env map[string]string
|
|
|
|
Sources []string
|
|
|
|
Command string
|
|
|
|
Args []string
|
|
|
|
CustomErrors map[int8]error
|
|
|
|
Cwd string
|
|
|
|
Shell string
|
2024-07-04 22:40:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Errors
|
|
|
|
var (
|
2024-07-04 23:14:10 +02:00
|
|
|
ErrFetchingCwd = errors.New("error fetching cwd")
|
|
|
|
ErrRunningCmd = errors.New("error running command")
|
|
|
|
ErrCommandNotFound = errors.New("error command not found")
|
|
|
|
ErrCommandNotExecutable = errors.New("error command not executable")
|
2024-07-06 17:48:45 +02:00
|
|
|
ErrInvalidHandler = errors.New("invalid handler")
|
2024-07-06 21:09:17 +02:00
|
|
|
ErrRunningEvt = errors.New("error running event")
|
2024-07-04 22:40:13 +02:00
|
|
|
)
|