commander-cli / cmd Goto Github PK
View Code? Open in Web Editor NEWA simple package to execute shell commands on linux, windows and osx
License: MIT License
A simple package to execute shell commands on linux, windows and osx
License: MIT License
It would be great to be able to override the base command. In my case, I'd like to have the ability to run linux commands on a remote server (via ssh) and at the moment that is not possible.
If the timeout is not set it's default is set to 0, so no command will ever be executed successfully.
Analyse the stdcopy.Stdcopy package from docker:
github.com/docker/docker/pkg/stdcopy/stdcopy.go:94
It could demultiplex a multiplexed stream written to stdout and stderr
In the case of the process of the command timing out we will respect its error code, but in the case of when we elect to timeout and kill the command what should we do.
There's a case for returning a 124
to signal timeout or get the SIGTERM exit code of 143
. I'm not quite sure I have a good opinion on either, but we need to remember we return an error the client describing that we timed out. In either case the client would be able to verify the code.
Also another option is to return a completely irrelevant code like -1
just as long as it's non zero
c := cmd.NewCommand(`"C:\Program Files\Java\jre1.8.0_192\bin\java.exe" --version`)
_ = c.Execute()
fmt.Println(c.Stdout())
fmt.Println(c.Stderr())
'\"C:\Program Files\Java\jre1.8.0_192\bin\java.exe\"' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���
Plz focus on the path string. And I don't know why \"
instead of "
c := cmd.NewCommand(`C:\Program Files\Java\jre1.8.0_192\bin\java.exe --version`)
_ = c.Execute()
fmt.Println(c.Stdout())
fmt.Println(c.Stderr())
'C:\Program' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���
Ex.1 and Ex.2 can solve by define the workingDir
When some problem need an arguments with a windows style file with space, the error occurs.
And I didn't find the way to solve it.
Plz help~
like:
Execute(ctx context.Context)
I want to graceful quit the cmd manually
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.