{"modulePath":"github.com/bootllm/tester-utils","version":"v1.1.0","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package executable\n\n## Constants\n\n```go\nconst DefaultMemoryLimitInBytes int64 = 2 * 1024 * 1024 * 1024\n```\nDefaultMemoryLimitInBytes is the default memory limit (2GB)\n\n## Variables\n\n```go\nvar ErrMemoryLimitExceeded = errors.New(\"process exceeded memory limit\")\n```\nErrMemoryLimitExceeded is returned when a process exceeds its memory limit\n\n## Types\n\n```go\ntype Executable struct {\n\t// Path is the path to the executable.\n\tPath string\n\n\t// TimeoutInMilliseconds is the maximum time the process can run.\n\tTimeoutInMilliseconds int\n\n\t// MemoryLimitInBytes sets the maximum memory the process can use (Linux only).\n\t// If exceeded, the process will be killed and an error will be returned.\n\t// Defaults to 2GB. Set to 0 to disable memory limiting.\n\tMemoryLimitInBytes int64\n\n\t// ShouldUsePty controls whether the executable's standard streams should be set to PTY instead of pipes.\n\tShouldUsePty bool\n\n\t// WorkingDir can be set before calling Start or Run to customize the working directory of the executable.\n\tWorkingDir string\n\n\t// Process is the os.Process object for the executable.\n\t// TODO: See if this actually needs to be exported?\n\tProcess *os.Process\n\t// contains filtered or unexported fields\n}\n```\nExecutable represents a program that can be executed\n\n```go\nfunc NewExecutable(path string) *Executable\n```\nNewExecutable returns an Executable\n\n```go\nfunc NewVerboseExecutable(path string, loggerFunc func(string)) *Executable\n```\nNewVerboseExecutable returns an Executable struct with a logger configured\n\n```go\nfunc (e *Executable) Clone() *Executable\n```\n\n```go\nfunc (e *Executable) HasExited() bool\n```\n\n```go\nfunc (e *Executable) Kill() error\n```\nKill terminates the program\n\n```go\nfunc (e *Executable) Run(args ...string) (ExecutableResult, error)\n```\nRun starts the specified command, waits for it to complete and returns the result.\n\n```go\nfunc (e *Executable) RunWithStdin(stdin []byte, args ...string) (ExecutableResult, error)\n```\nRunWithStdin starts the specified command, sends input, waits for it to complete and returns the result.\n\n```go\nfunc (e *Executable) SendLine(line string) error\n```\nSendLine writes a line to the process's stdin (for interactive mode). Automatically appends a newline character.\n\n```go\nfunc (e *Executable) Start(args ...string) error\n```\nStart starts the specified command but does not wait for it to complete.\n\n```go\nfunc (e *Executable) Wait() (ExecutableResult, error)\n```\nWait waits for the program to finish and returns the result.\n\n```go\nfunc (e *Executable) WriteStdin(data []byte) error\n```\nWriteStdin writes data to the process's stdin (for interactive mode). The process must be started with Start() first.\n\n```go\ntype ExecutableResult struct {\n\tStdout   []byte\n\tStderr   []byte\n\tExitCode int\n}\n```\nExecutableResult holds the result of an executable run\n\n","path":"github.com/bootllm/tester-utils/executable","name":"executable","synopsis":"","isRedistributable":true}
