Skip to content

Instantly share code, notes, and snippets.

@kaneshin
Created January 4, 2017 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaneshin/383e5f1c0713f1ab3bc39d3b21d11cae to your computer and use it in GitHub Desktop.
Save kaneshin/383e5f1c0713f1ab3bc39d3b21d11cae to your computer and use it in GitHub Desktop.
package main
import (
"bytes"
"fmt"
"os/exec"
)
func main() {
cmd := exec.Command("ls", "-lf")
var buf bytes.Buffer
cmd.Stdout = &buf
if err := cmd.Run(); err != nil {
panic(err)
}
fmt.Println(buf.String())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment