Commit 878608bd authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

cmd/go: connect os.Stdin for go run

Fixes #2875

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5641052
parent 3f6a517d
......@@ -7,6 +7,7 @@ package main
import (
"fmt"
"os"
"os/exec"
"strings"
)
......@@ -61,6 +62,19 @@ func (b *builder) runProgram(a *action) error {
return nil
}
}
run(a.deps[0].target, a.args)
runStdin(a.deps[0].target, a.args)
return nil
}
// runStdin is like run, but connects Stdin.
func runStdin(cmdargs ...interface{}) {
cmdline := stringList(cmdargs...)
cmd := exec.Command(cmdline[0], cmdline[1:]...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
errorf("%v", err)
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment