aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/env.go
diff options
context:
space:
mode:
authorTobias Bosch <tbosch@google.com>2019-08-20 15:37:11 -0700
committerTobias Bosch <tbosch@google.com>2019-08-21 14:55:05 +0000
commit6f59a66192c620b00f3ef6eec8e798e25ab6636c (patch)
tree65d5fe26e84e4bfd541e2074aaf3fe814b110f6f /compiler_wrapper/env.go
parentedaab0ffdce3754413699e082b69f3f582177553 (diff)
downloadtoolchain-utils-6f59a66192c620b00f3ef6eec8e798e25ab6636c.tar.gz
Only tee stdin if a "-" was passed the compiler.
This allows to remove the workaround in env.Run, and fixes the bug in the workaround that it didn't return exit code errors correctly. BUG=chromium:773875 TEST=manually tested in the chroot. Change-Id: I486b30b65ba3ad6249aa89e82e292c66378187a2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1762345 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper/env.go')
-rw-r--r--compiler_wrapper/env.go18
1 files changed, 0 insertions, 18 deletions
diff --git a/compiler_wrapper/env.go b/compiler_wrapper/env.go
index bbf3ec45..5f5cde38 100644
--- a/compiler_wrapper/env.go
+++ b/compiler_wrapper/env.go
@@ -72,24 +72,6 @@ func (env *processEnv) run(cmd *command, stdin io.Reader, stdout io.Writer, stde
execCmd.Stdin = stdin
execCmd.Stdout = stdout
execCmd.Stderr = stderr
- _, stdinIsFile := stdin.(*os.File)
- _, stdinIsBytesReader := stdin.(*bytes.Reader)
- if stdin != nil && !stdinIsFile && !stdinIsBytesReader {
- // We can't use execCmd.Run() here as that blocks if stdin blocks,
- // even if the underlying process has already terminated. We care
- // especially about the case when stdin is an io.TeeReader for os.Stdin.
- // See https://github.com/golang/go/issues/7990 for more details.
- if err := execCmd.Start(); err != nil {
- return err
- }
- if _, err := execCmd.Process.Wait(); err != nil {
- return err
- }
- // Closing Stdin here as we didn't wait for the read to finish via
- // execCmd.Wait to prevent race conditions.
- os.Stdin.Close()
- return nil
- }
return execCmd.Run()
}