This commit is contained in:
Mark McGranaghan
2012-09-23 17:49:22 -07:00
parent e4b083d49b
commit d7045c962c
49 changed files with 2 additions and 47 deletions

View File

@@ -0,0 +1,18 @@
// ## Spawning Processes
package main
import "os/exec"
import "fmt"
func main() {
cmd := exec.Command("ls", "-a", "-l")
out, err := cmd.Output()
if err != nil {
panic(err)
}
fmt.Println("Files:")
fmt.Print(string(out))
}
// todo: full command lines with bash

View File

@@ -0,0 +1,6 @@
$ go run spawning-processes.go
Files:
total 8
drwxr-xr-x 3 mmcgrana staff 102 Sep 23 11:35 .
drwxr-xr-x 101 mmcgrana staff 3434 Sep 23 11:25 ..
-rw-r--r--@ 1 mmcgrana staff 241 Sep 23 11:37 spawning-processes.go