Documentation ¶
Index ¶
- func CopyAll(src, dst string) (fileCount uint, err error)
- func CopyFile(src, dst string) error
- func CopyFileWithPerms(src, dst string, perm os.FileMode) error
- func Exec(cmd *exec.Cmd, out io.Writer, setters ...CommandOptionSetter) error
- func ExecL(cmd *exec.Cmd, out io.Writer, logger log.FieldLogger, ...) error
- func ExecWithInput(cmd *exec.Cmd, input string, out io.Writer, setters ...CommandOptionSetter) error
- func RemoveAll(dir string) error
- type CommandOptionSetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFile ¶
CopyFile copies contents of src to dst atomically using SharedReadWriteMask as permissions.
func CopyFileWithPerms ¶
CopyFileWithPerms copies the contents from src to dst atomically. If dst does not exist, CopyFile creates it with permissions perm. If the copy fails, CopyFile aborts and dst is preserved. Adopted with modifications from https://go-review.googlesource.com/#/c/1591/9/src/io/ioutil/ioutil.go
func Exec ¶
ExecL executes the specified command and outputs its Stdout/Stderr into the specified writer `out`. Accepts configuration as a series of CommandOptionSetters
func ExecL ¶
func ExecL(cmd *exec.Cmd, out io.Writer, logger log.FieldLogger, setters ...CommandOptionSetter) error
ExecL executes the specified command and outputs its Stdout/Stderr into the specified writer `out`, using `logger` for logging. Accepts configuration as a series of CommandOptionSetters
func ExecWithInput ¶
func ExecWithInput(cmd *exec.Cmd, input string, out io.Writer, setters ...CommandOptionSetter) error
ExecWithInput executes the specified command and outputs its Stdout/Stderr into the specified writer `out`. Uses `input` to provide command with Stdin input Accepts configuration as a series of CommandOptionSetters
Types ¶
type CommandOptionSetter ¶
CommandOptionSetter defines an interface to configure child process before execution
func Dir ¶
func Dir(dir string) CommandOptionSetter
Dir sets working directory for the child process
func SetEnv ¶
func SetEnv(envs ...string) CommandOptionSetter
SetEnv passes specified environment variables to the child process