Documentation ¶
Overview ¶
Package eows is used to Execute commands Over WebSocket
Package eows is used to Execute commands Over WebSocket
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DoneChan ¶
type DoneChan struct {
// contains filtered or unexported fields
}
DoneChan Channel used to propagate status+error on command exit
type EmitExitCB ¶
type EmitExitCB func(e *ExecOverWS, code int, err error)
EmitExitCB is the function callback used to emit exit proc code
type EmitOutputCB ¶
type EmitOutputCB func(e *ExecOverWS, stdout, stderr []byte)
EmitOutputCB is the function callback used to emit data
type ExecOverWS ¶
type ExecOverWS struct { Cmd string // command name to execute Args []string // command arguments SocketIO *socketio.Socket // websocket Sid string // websocket ID CmdID string // command ID // Optional fields Env []string // command environment variables CmdExecTimeout int // command execution time timeout Log *logrus.Logger // logger (nil if disabled) InputEvent string // websocket input event name InputCB OnInputCB // stdin callback OutputCB EmitOutputCB // stdout/stderr callback ExitCB EmitExitCB // exit proc callback UserData *map[string]interface{} // user data passed to callbacks OutSplit SplitType // split method to tokenize stdout/stderr LineTimeSpan int64 // time span (only used with SplitTime or SplitLineTime) PtyMode bool // Allocate a pseudo-terminal (allow to execute screen-based program) PtyTermEcho bool // Turn on/off terminal echo // contains filtered or unexported fields }
ExecOverWS .
func GetEows ¶
func GetEows(cmdID string) *ExecOverWS
GetEows gets ExecOverWS object from command ID
func New ¶
func New(cmd string, args []string, so *socketio.Socket, soID, cmdID string) *ExecOverWS
New creates a new instace of eows
func (*ExecOverWS) Signal ¶
func (e *ExecOverWS) Signal(signal string) error
Signal sends a signal to the running command / process
func (*ExecOverWS) Start ¶
func (e *ExecOverWS) Start() error
Start executes the command and redirect stdout/stderr into a WebSocket
func (*ExecOverWS) TerminalSetSize ¶ added in v0.2.0
func (e *ExecOverWS) TerminalSetSize(rows, cols uint16) error
TerminalSetSize Set terminal size
func (*ExecOverWS) TerminalSetSizePos ¶ added in v0.2.0
func (e *ExecOverWS) TerminalSetSizePos(rows, cols, x, y uint16) error
TerminalSetSizePos Set terminal size and position
type OnInputCB ¶
type OnInputCB func(e *ExecOverWS, stdin []byte) ([]byte, error)
OnInputCB is the function callback used to receive data