# Packages
No description provided by the author
# README
Shell
Shell related functions and stuff
Execute
The module provides convenient way to execute external commands and deal with its stdout
/stderr
as well as with stdin
(see unit tests for examples)
command := MakeCommand("sed", "-e", "s/a/A/g")
execution, _ := Execute(command)
execution.Stdin <- []byte("aaa")
close(execution.Stdin)
for run := true; run; {
select {
case out := <-execution.Stdout:
fmt.Print(string(out))
case err := <-execution.Stderr:
fmt.Println(string(err))
case <-execution.Exit:
run = false
case <-time.After(time.Second * 3):
t.Error("process killed by timeout")
execution.Kill()
run = false
}
}