github.com/matthewbelisle-wf/godep@v0.0.0-20140716191328-dba190f14fc8/util.go (about) 1 package main 2 3 import ( 4 "os" 5 "os/exec" 6 ) 7 8 // Returns true if path definitely exists; false if path doesn't 9 // exist or is unknown because of an error. 10 func exists(path string) bool { 11 _, err := os.Stat(path) 12 return err == nil 13 } 14 15 // Runs a command in dir. 16 // The name and args are as in exec.Command. 17 // Stdout, stderr, and the environment are inherited 18 // from the current process. 19 func runIn(dir, name string, args ...string) error { 20 c := exec.Command(name, args...) 21 c.Dir = dir 22 c.Stdout = os.Stdout 23 c.Stderr = os.Stderr 24 return c.Run() 25 }