Created
January 4, 2017 10:29
-
-
Save kaneshin/383e5f1c0713f1ab3bc39d3b21d11cae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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