Documentation
¶
Index ¶
- func Start(ctx context.Context, command, workdir string, env []string, ...) (*Session, PreparationStatus, error)
- func StartCommandWithTTY(ctx context.Context, build CommandFactory, timeout time.Duration, tty bool, ...) (*Session, PreparationStatus, error)
- func StartWithTTY(ctx context.Context, command, workdir string, env []string, ...) (*Session, PreparationStatus, error)
- type CommandFactory
- type ExecutionContext
- type PreparationStatus
- type PrepareFunc
- type Session
- func (s *Session) CloseStdin() error
- func (s *Session) Completed() bool
- func (s *Session) CompletedBefore(cutoff time.Time) bool
- func (s *Session) Kill() (bool, error)
- func (s *Session) Peek(status string, maxBytes int) Snapshot
- func (s *Session) SetExecutionContext(execution ExecutionContext)
- func (s *Session) Snapshot(status string, maxBytes int) Snapshot
- func (s *Session) Summary() Summary
- func (s *Session) WaitError() error
- func (s *Session) Write(text string) error
- type Snapshot
- type Store
- func (s *Store) Add(session *Session)
- func (s *Store) AddReserved(session *Session)
- func (s *Store) BeginClose()
- func (s *Store) Closing() bool
- func (s *Store) Delete(id string)
- func (s *Store) FinishStart()
- func (s *Store) Get(id string) (*Session, bool)
- func (s *Store) List() []*Session
- func (s *Store) PruneCompletedBefore(cutoff time.Time) int
- func (s *Store) PruneCompletedToLimit(limit int) int
- func (s *Store) ReleaseReservation()
- func (s *Store) ReservationCount() int
- func (s *Store) StartingCount() int
- func (s *Store) TryReserve(maxRunning int) bool
- func (s *Store) WaitForReservations(ctx context.Context) bool
- func (s *Store) WaitForStarts(ctx context.Context) bool
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Start ¶
func Start(ctx context.Context, command, workdir string, env []string, timeout time.Duration, prepare PrepareFunc) (*Session, PreparationStatus, error)
func StartCommandWithTTY ¶
func StartCommandWithTTY(ctx context.Context, build CommandFactory, timeout time.Duration, tty bool, prepare PrepareFunc) (*Session, PreparationStatus, error)
func StartWithTTY ¶
Types ¶
type ExecutionContext ¶
type PreparationStatus ¶ added in v0.8.2
type PrepareFunc ¶
type PrepareFunc func(*exec.Cmd) (func(), PreparationStatus)
type Session ¶
type Session struct {
ID string
Command *exec.Cmd
Cancel context.CancelFunc
Stdin io.WriteCloser
StartedAt time.Time
FinishedAt time.Time
Done chan struct{}
TimedOut bool
Terminal string
// contains filtered or unexported fields
}
func (*Session) CloseStdin ¶
func (*Session) Peek ¶
Peek returns the current unread output without advancing the observation cursors. Mutation tools use it so a following status call still receives the output.
func (*Session) SetExecutionContext ¶
func (s *Session) SetExecutionContext(execution ExecutionContext)
type Snapshot ¶ added in v0.8.2
type Snapshot struct {
SessionID string
Status string
Stdout string
Stderr string
ElapsedMS int64
TimedOut bool
Terminal string
StdoutOutputBytes int
StderrOutputBytes int
StdoutTotalBytes int
StderrTotalBytes int
StdoutDroppedBytes int
StderrDroppedBytes int
StdoutOmittedBytes int
StderrOmittedBytes int
StdoutOutputLines int
StderrOutputLines int
StdoutTruncated bool
StderrTruncated bool
Completed bool
ExitCode int
CommandOK bool
Runtime string
WSLDistribution string
Workdir string
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AddReserved ¶
func (*Store) BeginClose ¶ added in v0.8.1
func (s *Store) BeginClose()
func (*Store) FinishStart ¶ added in v0.8.1
func (s *Store) FinishStart()
FinishStart 标记命令已经离开不可安全抢占的启动窗口。 调用方必须在 runner、进程控制器和取消监听都建立完成后调用。
func (*Store) PruneCompletedToLimit ¶
func (*Store) ReleaseReservation ¶
func (s *Store) ReleaseReservation()
func (*Store) ReservationCount ¶
func (*Store) StartingCount ¶ added in v0.8.1
func (*Store) TryReserve ¶
func (*Store) WaitForReservations ¶ added in v0.8.1
Click to show internal directories.
Click to hide internal directories.