You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shell expansion (such as *) is a feature of the shells, not of the program that is executed, or of Go.
You need to provide all parameters yourself. If you want to send a list of files to the command, you can use io/ioutil.ReadDir to build the list manually.
What @zegl said. os/exec intentionally does not provide shell expansion APIs. You need to either explicitly exec the shell and have the shell do it, or explicitly glob yourself and pass the files.
What version of Go are you using (
go version
)?1.8
What operating system and processor architecture are you using (
go env
)?amd64
What did you do?
I cant seem to exec.Command() on any parameter which has a * or splat character. They all fail.
What did you expect to see?
I expect it to run like it runs in the shell.
What did you see instead?
err returned.
Please help!! My workaround is to write my shell script to disk and exec it and it works perfectly fine.
The text was updated successfully, but these errors were encountered: