Skip to content

Latest commit

 

History

History
66 lines (49 loc) · 1.86 KB

readme.md

File metadata and controls

66 lines (49 loc) · 1.86 KB

urun

-- import "github.com/go-leap/run"

Usage

func CmdExec

func CmdExec(cmdName string, cmdArgs ...string) (stdout string, stderr string, err error)

CmdExecStdin runs the specified program, returning its full stdout response and whitespace-trimmed stderr response.

func CmdExecIn

func CmdExecIn(dir string, cmdName string, cmdArgs ...string) (stdout string, stderr string, err error)

CmdExecStdin runs the specified program in the specified dir (if any), returning its full stdout response and whitespace-trimmed stderr response.

func CmdExecStdin

func CmdExecStdin(stdin string, dir string, cmdName string, cmdArgs ...string) (stdout string, stderr string, err error)

CmdExecStdin runs the specified program with the specified stdin (if any), returning its full stdout response and whitespace-trimmed stderr response.

func CmdTryStart

func CmdTryStart(cmdname string, cmdargs ...string) (err error)

CmdTryStart attempts to run the specified program, records whether this resulted in an error, and immediately kills the program before returning.

func CmdsTryStart

func CmdsTryStart(cmds map[string]*CmdTry)

CmdsTryStart calls CmdTryStart for all specified cmds in parallel.

func SetupIpcPipes

func SetupIpcPipes(bufferCapacity int, ipcSplitProtocol bufio.SplitFunc, needJsonOut bool) (stdin *bufio.Scanner, rawOut *bufio.Writer, jsonOut *json.Encoder)

SetupIpcPipes sets up IPC pipes with the specified bufferCapacity. If ipcSplitProtocol is nil, a readline-writeline ping-pong protocol is assumed. Only if needJsonOut, is jsonOut allocated via json.NewEncoder(rawOut).

type CmdTry

type CmdTry struct {
	Args []string
	Ran  *bool
}

CmdTry is used for CmdsTryStart to probe in parallel the installation status of multiple programs.