runner

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxMsgSize = 4096 << 10 // 4 MiB

)

Variables

This section is empty.

Functions

func ConvertRunnerProject added in v1.4.0

func ConvertRunnerProject(runnerProj *runnerv1.Project) (project.Project, error)

func GlobalShellPath added in v1.2.1

func GlobalShellPath() string

func IsShell added in v0.5.0

func IsShell(lang string) bool

func IsShellLanguage added in v1.6.0

func IsShellLanguage(languageID string) bool

func IsSupported added in v0.2.4

func IsSupported(lang string) bool

func NewRunnerService added in v0.6.0

func NewRunnerService(logger *zap.Logger) (runnerv1.RunnerServiceServer, error)

func NewRunnerServiceHandler added in v0.6.0

func NewRunnerServiceHandler(logger *zap.Logger) (runnerv1connect.RunnerServiceHandler, error)

func PrepareScriptFromCommands added in v0.6.0

func PrepareScriptFromCommands(cmds []string, shell string) string

func ResolveShellPath added in v1.2.1

func ResolveShellPath(customShell string) string

func ShellFromShellPath added in v0.6.2

func ShellFromShellPath(programPath string) string

TODO(mxs): this method for determining shell is not strong, since shells can be aliased. we should probably run the shell to get this information

Types

type CommandMode added in v1.6.0

type CommandMode uint
const (
	// Do not send script to program
	CommandModeNone CommandMode = iota
	// Send script as argument to "-c"
	CommandModeInlineShell
	// Send script as temporary file in cwd
	CommandModeTempFile
)

func GetCellProgram added in v1.6.0

func GetCellProgram(languageID string, customShell string, cell *document.CodeBlock) (program string, commandMode CommandMode)

type ErrInvalidLanguage added in v1.6.0

type ErrInvalidLanguage struct {
	LanguageID string
}

func (ErrInvalidLanguage) Error added in v1.6.0

func (e ErrInvalidLanguage) Error() string

type ErrInvalidProgram added in v1.6.0

type ErrInvalidProgram struct {
	Program string
	// contains filtered or unexported fields
}

func (ErrInvalidProgram) Error added in v1.6.0

func (e ErrInvalidProgram) Error() string

func (ErrInvalidProgram) Unwrap added in v1.6.0

func (e ErrInvalidProgram) Unwrap() error

type Executable

type Executable interface {
	DryRun(context.Context, io.Writer)
	Run(context.Context) error
	ExitCode() int
}

type ExecutableConfig added in v0.6.0

type ExecutableConfig struct {
	Name    string
	Dir     string
	Tty     bool
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
	PreEnv  []string
	PostEnv []string
	Session *Session
	Logger  *zap.Logger
}

type ExitError added in v0.6.2

type ExitError struct {
	Code    uint
	Wrapped error
}

func ExitErrorFromExec added in v0.6.2

func ExitErrorFromExec(e *exec.ExitError) *ExitError

func (ExitError) Error added in v0.6.2

func (e ExitError) Error() string

func (ExitError) Unwrap added in v0.6.2

func (e ExitError) Unwrap() error

type Go

type Go struct {
	*ExecutableConfig
	Source string
	// contains filtered or unexported fields
}

func (Go) DryRun

func (g Go) DryRun(ctx context.Context, w io.Writer)

func (Go) ExitCode added in v0.6.2

func (g Go) ExitCode() int

func (*Go) Run

func (g *Go) Run(ctx context.Context) error

type Session added in v0.6.0

type Session struct {
	ID       string
	Metadata map[string]string
	// contains filtered or unexported fields
}

Session is an abstract entity separate from an execution. Currently, its main role is to keep track of environment variables.

func NewSession added in v0.6.0

func NewSession(envs []string, proj project.Project, logger *zap.Logger) (*Session, error)

func (*Session) AddEnvs added in v0.6.0

func (s *Session) AddEnvs(envs []string)

func (*Session) Envs added in v0.6.0

func (s *Session) Envs() []string

type SessionList added in v0.7.0

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

thread-safe session list

func NewSessionList added in v0.7.0

func NewSessionList() (*SessionList, error)

func (*SessionList) AddSession added in v0.7.0

func (sl *SessionList) AddSession(session *Session)

func (*SessionList) CreateAndAddSession added in v0.7.0

func (sl *SessionList) CreateAndAddSession(generate func() (*Session, error)) (*Session, error)

func (*SessionList) DeleteSession added in v0.7.0

func (sl *SessionList) DeleteSession(id string) (present bool)

func (*SessionList) GetSession added in v0.7.0

func (sl *SessionList) GetSession(id string) (*Session, bool)

func (*SessionList) ListSessions added in v0.7.0

func (sl *SessionList) ListSessions() ([]*Session, error)

func (*SessionList) MostRecent added in v0.7.0

func (sl *SessionList) MostRecent() (*Session, bool)

func (*SessionList) MostRecentOrCreate added in v0.7.0

func (sl *SessionList) MostRecentOrCreate(generate func() (*Session, error)) (*Session, error)

type Shell

type Shell struct {
	*ExecutableConfig

	Cmds        []string
	CustomShell string
	// contains filtered or unexported fields
}

func (Shell) DryRun

func (s Shell) DryRun(ctx context.Context, w io.Writer)

func (Shell) ExitCode added in v0.6.2

func (s Shell) ExitCode() int

func (Shell) ProgramPath added in v0.6.0

func (s Shell) ProgramPath() string

func (*Shell) Run

func (s *Shell) Run(ctx context.Context) error

func (Shell) ShellType added in v0.6.2

func (s Shell) ShellType() string

type ShellRaw added in v0.3.0

type ShellRaw struct {
	*Shell
}

func (ShellRaw) DryRun added in v0.3.0

func (s ShellRaw) DryRun(ctx context.Context, w io.Writer)

func (ShellRaw) Run added in v0.3.0

func (s ShellRaw) Run(ctx context.Context) error

type ShellSession added in v0.6.0

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

func NewShellSession added in v0.6.0

func NewShellSession(command string) (*ShellSession, error)

func (*ShellSession) Close added in v0.6.0

func (s *ShellSession) Close() error

func (*ShellSession) Done added in v0.6.0

func (s *ShellSession) Done() <-chan struct{}

func (*ShellSession) Err added in v0.6.0

func (s *ShellSession) Err() error

func (*ShellSession) ID added in v0.6.0

func (s *ShellSession) ID() string

func (*ShellSession) Send added in v0.6.0

func (s *ShellSession) Send(data []byte) error

type TempFile added in v1.6.0

type TempFile struct {
	*ExecutableConfig

	Script      string
	ProgramName string
	LanguageID  string
	// contains filtered or unexported fields
}

func (TempFile) DryRun added in v1.6.0

func (s TempFile) DryRun(ctx context.Context, w io.Writer)

func (TempFile) ExitCode added in v1.6.0

func (s TempFile) ExitCode() int

func (*TempFile) Run added in v1.6.0

func (s *TempFile) Run(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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