go-sh
go-sh copied to clipboard
like python-sh, for easy call shell with golang.
``` out, err := sh.Command("./1", sh.Dir("/opt/wdsf/1/")).Output() fmt.Println(string(out), err) ``` fork/exec ./1: exec format error
When I run a command, that have Multiline-Output I get an Error: ``` .\main.go:6:21: newline in string .\main.go:6:21: syntax error: unexpected newline, expecting comma or ) ``` Line 6 in...
go-sh包 ,用到DOCKER操作指令时是无信息返回的。 觉得非常奇怪。 go-sh包所在程序在宿主机上运行,运行docker --help是可以正常获得反馈, 但是使用docker ps -a之类的指令时,是无反馈回来的, 而在cmd面板ssh操作是可以正常反馈的。 是跨容器导致了这个问题吗,有办法解决吗?很头大
such as this cat file.txt >> test.txt
we may want to execute by `admin` account or other account
Hello! i tried use this: ``` package main import ( "github.com/codeskyblue/go-sh" "log" "fmt" ) func main() { port := uint(1) session := sh.NewSession() session.ShowCMD = true out, err := session.Command("/Users/Ivan/Downloads/redis-3.2.3/src/redis-server",...
Hello! I have question. I have this code: ``` session := sh.NewSession() session.SetTimeout(time.Second * 30) session.ShowCMD = true session.SetDir(repositoryPath) session.Command( "rm", "-f", archiveFile, "&&", "git", "archive", branchName, "--format", "tar", "--output",...
I need to execute `make` from go-sh, but I get this ``` configure: Setting lib to 'lib' (the default) configure: Will try -pthread then -lpthread to enable POSIX Threads. configure:...
It is possible to redirect output? Like: `mysqldump dbname | gzip -9 > dump.sql.gz` Or stderr: `tar czf archive.tar.gz ./dir/ 2> /tmp/error.log`
It is possible to get the stdoutPipe? just as func (c *Cmd) StdoutPipe() (io.ReadCloser, error) if so, we can get the output when we exec the commands