Skip to content

Commit

Permalink
Stream output in real time
Browse files Browse the repository at this point in the history
  • Loading branch information
the-redback committed Apr 2, 2019
1 parent dee56ab commit d8a373a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions peer-finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ func lookup(svcName string) (sets.String, error) {
func shellOut(sendStdin, script string) {
log.Printf("execing: %v with stdin: %v", script, sendStdin)
// TODO: Switch to sending stdin from go
out, err := exec.Command("bash", "-c", fmt.Sprintf("echo -e '%v' | %v", sendStdin, script)).CombinedOutput()
cmd := exec.Command("bash", "-c", fmt.Sprintf("echo -e '%v' | %v", sendStdin, script))
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
log.Fatalf("Failed to execute %v: %v, err: %v", script, string(out), err)
log.Fatalf("Failed to execute %v:, err: %v", script, err)
}
log.Print(string(out))
}

func main() {
Expand Down

0 comments on commit d8a373a

Please sign in to comment.