From d3c9b97930844f59275c01b755d2c32a0b94912a Mon Sep 17 00:00:00 2001 From: Lukas Bockstaller Date: Thu, 26 Oct 2023 10:31:41 +0200 Subject: [PATCH] Do not pass os.Stdin to launched command This is related to https://github.com/getgauge/gauge/issues/2419 - removes problematic line - references issue in the code - updates the dependencies in order to get go build and go test working Signed-off by: Lukas Bockstaller --- common.go | 6 ++++-- go.mod | 2 +- go.sum | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/common.go b/common.go index 925ce1e..6611a07 100644 --- a/common.go +++ b/common.go @@ -475,7 +475,7 @@ func CopyFile(src, dest string) error { return nil } -//Appends contents of source file to destination file. +// Appends contents of source file to destination file. // If destination file is not present, Copy file action is performed func AppendToFile(srcFile, destFile string) error { if FileExists(destFile) { @@ -542,7 +542,9 @@ func prepareCommand(isSystemCommand bool, command []string, workingDir string, o cmd.Dir = workingDir cmd.Stdout = outputStreamWriter cmd.Stderr = errorStreamWriter - cmd.Stdin = os.Stdin + // This function used to pass along os.Stdin like this + // cmd.Stdin = os.Stdin + // This has difficult to track down side effects as discussed here https://github.com/getgauge/gauge/issues/2419 return cmd } diff --git a/go.mod b/go.mod index f1e3c4d..0f60bc0 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.13 require ( github.com/dmotylev/goproperties v0.0.0-20140630191356-7cbffbaada47 github.com/go-check/check v0.0.0-20190902080502-41f04d3bba15 - github.com/kr/pretty v0.1.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) diff --git a/go.sum b/go.sum index ae00c16..efbd939 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,10 @@ github.com/go-check/check v0.0.0-20190902080502-41f04d3bba15 h1:xJdCV5uP69sUzCII github.com/go-check/check v0.0.0-20190902080502-41f04d3bba15/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=