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 ¶
- func FormatForShell(name string, args string) (string, []string)
- func FormatForShellQuotedArgs(name string, args []string) (string, []string)
- func FormatPercentSequences(pattern string, replacements map[string]string) string
- func LookPath(file string) (string, error)
- func Output(cmd *Cmd) (string, error)
- func ResetEnvironment()
- func ShellQuote(strs []string) []string
- func ShellQuoteSingle(str string) string
- func SimpleExec(name string, args ...string) (string, error)
- func Trace(name string, args ...string)
- type BufferedCmd
- type Cmd
- func (c *Cmd) CombinedOutput() ([]byte, error)
- func (c *Cmd) Output() ([]byte, error)
- func (c *Cmd) Run() error
- func (c *Cmd) Start() error
- func (c *Cmd) StderrPipe() (io.ReadCloser, error)
- func (c *Cmd) StdinPipe() (io.WriteCloser, error)
- func (c *Cmd) StdoutPipe() (io.ReadCloser, error)
- func (c *Cmd) Wait() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatForShell ¶
FormatForShell takes a command name and an argument string and returns a command and arguments that pass this command to the shell. Note that neither the command nor the arguments are quoted. Consider FormatForShellQuoted instead.
func FormatForShellQuotedArgs ¶
FormatForShellQuotedArgs takes a command name and an argument string and returns a command and arguments that pass this command to the shell. The arguments are escaped, but the name of the command is not.
func FormatPercentSequences ¶ added in v3.2.0
func LookPath ¶
LookPath searches for an executable named file in the directories named by the PATH environment variable. If file contains a slash, it is tried directly and the PATH is not consulted. The result may be an absolute path or a path relative to the current directory.
func ResetEnvironment ¶
func ResetEnvironment()
ResetEnvironment resets the cached environment that's used in subprocess calls.
func ShellQuote ¶
ShellQuote returns a copied string slice where each element is quoted suitably for sh.
func ShellQuoteSingle ¶
ShellQuoteSingle returns a string which is quoted suitably for sh.
func SimpleExec ¶
SimpleExec is a small wrapper around os/exec.Command.
Types ¶
type BufferedCmd ¶
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 ¶
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 ¶
ExecCommand is a small platform specific wrapper around os/exec.Command
func (*Cmd) CombinedOutput ¶
func (*Cmd) StderrPipe ¶
func (c *Cmd) StderrPipe() (io.ReadCloser, error)
func (*Cmd) StdoutPipe ¶
func (c *Cmd) StdoutPipe() (io.ReadCloser, error)