Skip to content

Instantly share code, notes, and snippets.

@kwmt
Created September 23, 2013 16:14
Show Gist options
  • Save kwmt/6672954 to your computer and use it in GitHub Desktop.
Save kwmt/6672954 to your computer and use it in GitHub Desktop.
package main
import "os"
func main() {
if len(os.Args) < 2 {
println("usage: %s program arg1 arg2 ...", os.Args[0])
return
}
var procAttr os.ProcAttr
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
process, err := os.StartProcess(os.Args[1], os.Args[1:], &procAttr)
if err != nil {
println("start process failed:" + err.Error())
return
}
_, err = process.Wait()
if err != nil {
println("Wait Error:" + err.Error())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment