Created
November 24, 2015 05:05
-
-
Save ssbb/a83b6537139d79ee6e1b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ( | |
"fmt" | |
"log" | |
"os/exec" | |
) | |
func main() { | |
data := make([]byte, 1024*512) | |
cmd := exec.Command("wc") | |
stdin, err := cmd.StdinPipe() | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Println("Writing ot stdin...") | |
stdin.Write(data) | |
stdin.Close() | |
fmt.Println("Wrote to stdin") | |
code := cmd.Run() | |
fmt.Println(code) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment