shellexec

package
v0.8.3-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGracefulKillWait = 400 * time.Millisecond

Variables

This section is empty.

Functions

func ExitCodeFromWaitErr

func ExitCodeFromWaitErr(err error) int

func RunSimpleCmdInPty

func RunSimpleCmdInPty(ecmd *exec.Cmd, termSize waveobj.TermSize) ([]byte, error)

Types

type CmdWrap

type CmdWrap struct {
	Cmd *exec.Cmd
	pty.Pty
}

func (CmdWrap) Kill

func (cw CmdWrap) Kill()

func (CmdWrap) KillGraceful

func (cw CmdWrap) KillGraceful(timeout time.Duration)

func (CmdWrap) SetSize

func (cw CmdWrap) SetSize(w int, h int) error

func (CmdWrap) Start

func (cw CmdWrap) Start() error

func (CmdWrap) StderrPipe

func (cw CmdWrap) StderrPipe() (io.ReadCloser, error)

func (CmdWrap) StdinPipe

func (cw CmdWrap) StdinPipe() (io.WriteCloser, error)

func (CmdWrap) StdoutPipe

func (cw CmdWrap) StdoutPipe() (io.ReadCloser, error)

func (CmdWrap) Wait

func (cw CmdWrap) Wait() error

type CommandOptsType

type CommandOptsType struct {
	Interactive bool              `json:"interactive,omitempty"`
	Login       bool              `json:"login,omitempty"`
	Cwd         string            `json:"cwd,omitempty"`
	Env         map[string]string `json:"env,omitempty"`
}

type ConnInterface

type ConnInterface interface {
	Kill()
	KillGraceful(time.Duration)
	Wait() error
	Start() error
	StdinPipe() (io.WriteCloser, error)
	StdoutPipe() (io.ReadCloser, error)
	StderrPipe() (io.ReadCloser, error)
	SetSize(w int, h int) error
	pty.Pty
}

type PipePty

type PipePty struct {
	// contains filtered or unexported fields
}

func (*PipePty) Close

func (pp *PipePty) Close() error

func (*PipePty) Fd

func (pp *PipePty) Fd() uintptr

func (*PipePty) Name

func (pp *PipePty) Name() string

func (*PipePty) Read

func (pp *PipePty) Read(p []byte) (n int, err error)

func (*PipePty) Write

func (pp *PipePty) Write(p []byte) (n int, err error)

func (*PipePty) WriteString

func (pp *PipePty) WriteString(s string) (n int, err error)

type SessionWrap

type SessionWrap struct {
	Session  *ssh.Session
	StartCmd string
	Tty      pty.Tty
	pty.Pty
}

func (SessionWrap) Kill

func (sw SessionWrap) Kill()

func (SessionWrap) KillGraceful

func (sw SessionWrap) KillGraceful(timeout time.Duration)

func (SessionWrap) SetSize

func (sw SessionWrap) SetSize(h int, w int) error

func (SessionWrap) Start

func (sw SessionWrap) Start() error

func (SessionWrap) StderrPipe

func (sw SessionWrap) StderrPipe() (io.ReadCloser, error)

func (SessionWrap) StdinPipe

func (sw SessionWrap) StdinPipe() (io.WriteCloser, error)

func (SessionWrap) StdoutPipe

func (sw SessionWrap) StdoutPipe() (io.ReadCloser, error)

func (SessionWrap) Wait

func (sw SessionWrap) Wait() error

type ShellProc

type ShellProc struct {
	ConnName  string
	Cmd       ConnInterface
	CloseOnce *sync.Once
	DoneCh    chan any // closed after proc.Wait() returns
	WaitErr   error    // WaitErr is synchronized by DoneCh (written before DoneCh is closed) and CloseOnce
}

func StartRemoteShellProc

func StartRemoteShellProc(termSize waveobj.TermSize, cmdStr string, cmdOpts CommandOptsType, conn *conncontroller.SSHConn) (*ShellProc, error)

func StartShellProc

func StartShellProc(termSize waveobj.TermSize, cmdStr string, cmdOpts CommandOptsType) (*ShellProc, error)

func (*ShellProc) Close

func (sp *ShellProc) Close()

func (*ShellProc) SetWaitErrorAndSignalDone

func (sp *ShellProc) SetWaitErrorAndSignalDone(waitErr error)

func (*ShellProc) Wait

func (sp *ShellProc) Wait() error

func (*ShellProc) WaitNB

func (sp *ShellProc) WaitNB() (bool, error)

returns (done, waitError)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL