subprocess

package
v2.5.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: MIT Imports: 11 Imported by: 100

Documentation

Overview

Package subprocess provides helper functions for forking new processes NOTE: Subject to change, do not rely on this package from outside git-lfs source

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Output

func Output(cmd *Cmd) (string, error)

func SimpleExec

func SimpleExec(name string, args ...string) (string, error)

SimpleExec is a small wrapper around os/exec.Command.

func Trace

func Trace(name string, args ...string)

Types

type BufferedCmd

type BufferedCmd struct {
	*Cmd

	Stdin  io.WriteCloser
	Stdout *bufio.Reader
	Stderr *bufio.Reader
}

func BufferedExec

func BufferedExec(name string, args ...string) (*BufferedCmd, error)

BufferedExec starts up a command and creates a stdin pipe and a buffered stdout & stderr pipes, wrapped in a BufferedCmd. The stdout buffer will be of stdoutBufSize bytes.

type Cmd

type Cmd struct {
	*exec.Cmd
	// contains filtered or unexported fields
}

Thin wrapper around exec.Cmd. Takes care of pipe shutdown by keeping an internal reference to any created pipes. Whenever Cmd.Wait() is called, all created pipes are closed.

func ExecCommand

func ExecCommand(name string, arg ...string) *Cmd

ExecCommand is a small platform specific wrapper around os/exec.Command

func (*Cmd) StderrPipe

func (c *Cmd) StderrPipe() (io.ReadCloser, error)

func (*Cmd) StdinPipe

func (c *Cmd) StdinPipe() (io.WriteCloser, error)

func (*Cmd) StdoutPipe

func (c *Cmd) StdoutPipe() (io.ReadCloser, error)

func (*Cmd) Wait

func (c *Cmd) Wait() error

type Tty

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

Tty is a convenience wrapper to allow pseudo-TTYs on *nix systems, create with NewTty() Do not use any of the struct members directly, call the Stderr() and Stdout() methods Remember to call Close() when finished

func NewTty

func NewTty(cmd *exec.Cmd) *Tty

NewTty creates a pseudo-TTY for a command and modifies it appropriately so the command thinks it's a real terminal

func (*Tty) Close

func (t *Tty) Close()

func (*Tty) Stderr

func (t *Tty) Stderr() (io.ReadCloser, error)

func (*Tty) Stdout

func (t *Tty) Stdout() (io.ReadCloser, error)

Jump to

Keyboard shortcuts

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