Documentation ¶
Index ¶
- type Commander
- func (c *Commander) AddEnv(key, value string) *Commander
- func (c *Commander) AppendEnv(env ...string) *Commander
- func (c *Commander) ErrOut(out ...io.Writer) *Commander
- func (c *Commander) GetOutput() ([]string, error)
- func (c *Commander) Name() string
- func (c *Commander) SetBackground(yes ...bool) *Commander
- func (c *Commander) SetCommand(path string, args ...string) *Commander
- func (c *Commander) SetDIR(dir string) *Commander
- func (c *Commander) SetEnv(env []string) *Commander
- func (c *Commander) SetName(name string) *Commander
- func (c *Commander) SetOnReceived(onReceived ReceiverFunc) *Commander
- func (c *Commander) SetOnStatusChanged(onStatusChanged StatusChangedFunc) *Commander
- func (c *Commander) SetQuit(quit <-chan struct{}) *Commander
- func (c *Commander) Start() error
- func (c *Commander) StdIn(in ...io.Reader) *Commander
- func (c *Commander) StdOut(out ...io.Writer) *Commander
- func (c *Commander) Stop() error
- func (c *Commander) String() string
- func (c *Commander) UseWindowsLegacyProcessStrategy(yes ...bool) *Commander
- func (c *Commander) Verbose(verbose bool) *Commander
- func (c *Commander) Wait() error
- func (c *Commander) WithContext(ctx context.Context) *Commander
- type PID
- type ReceiverFunc
- type Resource
- type Shell
- type Status
- type StatusChangedFunc
- type StatusCode
- type Step
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Commander ¶
type Commander struct { Status //状态 // contains filtered or unexported fields }
Commander 命令
func WithContext ¶ added in v0.0.6
func (*Commander) SetBackground ¶
SetBackground 后台运行(不阻断 Start 方法)
func (*Commander) SetCommand ¶
SetCommand 设置命令的执行路径(绝对路径或者相对DIR路径或者PATH)和参数
func (*Commander) SetOnReceived ¶
func (c *Commander) SetOnReceived(onReceived ReceiverFunc) *Commander
SetOnReceived 设置输出接收方法(逐行输出)
func (*Commander) SetOnStatusChanged ¶
func (c *Commander) SetOnStatusChanged(onStatusChanged StatusChangedFunc) *Commander
SetOnStatusChanged 设置状态变更监听
func (*Commander) UseWindowsLegacyProcessStrategy ¶
UseWindowsLegacyProcessStrategy 使用传统进程管理(windows)
type Shell ¶
type Shell struct { Name string `json:"name" yaml:"name" toml:"name"` Dir string `json:"dir" yaml:"dir" toml:"dir"` Env []string `json:"env" yaml:"env" toml:"env"` Step []*Step `json:"steps" yaml:"steps" toml:"steps"` }
func (*Shell) CreateCommander ¶
type Status ¶
type Status struct { PID //PID Err error //错误 Sig os.Signal //退出信号 Code int //退出代码 StartAt time.Time //启动时间 StopAt time.Time //停止时间 Status StatusCode //状态 }
Status 进程状态
type StatusCode ¶
type StatusCode int
const ( Ready StatusCode = 1 << iota Starting Running Stopping Stopped Exited )
Click to show internal directories.
Click to hide internal directories.