Golang os/exec.Cmd.Run() function examples
package os
Golang os/exec.Cmd.Run() function usage examples
NOTE : Run() starts the specified command and waits for it to complete. (asynchronous) as oppose to Start() which is (synchronous)
Example 1:
cmd := exec.Command("git", "clone", scheme+"://"+repo+".git", dir)
log.Println(strings.Join(cmd.Args, " "))
if err := cmd.Run(); err != nil {
return err
}
Example 2:
err := exec.Command("go", "get", "github.com/go-bootstrap/go-bootstrap").Run()
Reference :
Advertisement
Something interesting
Tutorials
+10.1k Golang : How to get quoted string into another string?
+28k Golang : Move file to another directory
+11.6k Golang : Surveillance with web camera and OpenCV
+87.7k Golang : How to convert character to ASCII and back
+12.3k Golang : Print UTF-8 fonts on image example
+20.2k Golang : How to get own program name during runtime ?
+35.3k Golang : Strip slashes from string example
+10.4k Golang : Simple Jawi(Yawi) to Rumi(Latin/Romanize) converter
+14.3k Golang : How to shuffle elements in array or slice?
+9.5k Golang : Accessing content anonymously with Tor
+26.4k Golang : Convert(cast) string to uint8 type and back to string
+19.2k Golang : Execute shell command