Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: 'go run' doesn't provide os.Stdin to the program it's running. #2875

Closed
gopherbot opened this issue Feb 3, 2012 · 2 comments
Closed

Comments

@gopherbot
Copy link

by consalus:

What steps will reproduce the problem?
1. 'go run' a program that takes input from Stdin.
2. It gets EOF, since it's run with os.DevNull as Stdin.


Which compiler are you using (5g, 6g, 8g, gccgo)?
The 'go' tool, since we no longer use the compiler directory.
But it's certainly using 6g.

Which operating system are you using?
Mac OS X 10.7.2


Which revision are you using?  (hg identify)
fbbc8c80bee2+ tip

Please provide any additional information below.

My simple-minded local fix is:

diff --git a/src/cmd/go/main.go b/src/cmd/go/main.go
--- a/src/cmd/go/main.go
+++ b/src/cmd/go/main.go
@@ -292,6 +292,7 @@
 func run(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 {
@bradfitz
Copy link
Contributor

bradfitz commented Feb 8, 2012

Comment 2:

http://golang.org/cl/5641052

Owner changed to @bradfitz.

Status changed to Started.

@bradfitz
Copy link
Contributor

bradfitz commented Feb 8, 2012

Comment 3:

This issue was closed by revision 878608b.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants