Documentation ¶
Index ¶
- func Connect(protoAddr string) (net.Conn, error)
- func DirExists(dirPath string) bool
- func EnsureDir(dir string, mode os.FileMode) error
- func Exit(s string)
- func FileExists(filePath string) bool
- func Kill() error
- func MakeAbs(path string, root string) string
- func MustReadFile(filePath string) []byte
- func MustWriteFile(filePath string, contents []byte, mode os.FileMode)
- func PrintAllGoroutines()
- func ProtocolAndAddress(listenAddr string) (string, string)
- func ReadFile(filePath string) ([]byte, error)
- func TrapSignal(cb func())
- func WriteFile(filePath string, contents []byte, mode os.FileMode) error
- func WriteFileAtomic(filename string, data []byte, perm os.FileMode) (err error)
- type Process
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
Connect dials the given address and returns a net.Conn. The protoAddr argument should be prefixed with the protocol, eg. "tcp://127.0.0.1:8080" or "unix:///tmp/test.sock"
func MustReadFile ¶
func PrintAllGoroutines ¶
func PrintAllGoroutines()
func ProtocolAndAddress ¶
ProtocolAndAddress splits an address into the protocol and address components. For instance, "tcp://127.0.0.1:8080" will be split into "tcp" and "127.0.0.1:8080". If the address has no protocol prefix, the default is "tcp".
func TrapSignal ¶
func TrapSignal(cb func())
TrapSignal catches the SIGTERM/SIGINT and executes cb function. After that it exits with code 0.
Types ¶
type Process ¶
type Process struct { Label string WorkDir string ExecPath string Args []string Pid int StartTime time.Time EndTime time.Time Cmd *exec.Cmd `json:"-"` ExitState *os.ProcessState `json:"-"` Stdin io.Reader `json:"-"` Stdout io.WriteCloser `json:"-"` Stderr io.WriteCloser `json:"-"` WaitCh chan struct{} `json:"-"` }
func StartProcess ¶
func StartProcess(label string, dir string, execPath string, args []string, stdin io.Reader, stdout, stderr io.WriteCloser) (*Process, error)
execPath: command name args: args to command. (should not include name)
func (*Process) StopProcess ¶
Click to show internal directories.
Click to hide internal directories.