aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-09-27 00:29:56 +0800
committerGitHub <noreply@github.com>2016-09-27 00:29:56 +0800
commit863d166c7b0250cf2e99c8aad69578cdd144d386 (patch)
tree53481e2ae95e42bca78d3e0d9b27d508441c7d6a
parent61734cc7ae8dfc194a214f9ae442deb95d79b3a4 (diff)
parentb04219fdbbef06527f77e93129d6a196b6841f44 (diff)
downloadgo-tangerine-863d166c7b0250cf2e99c8aad69578cdd144d386.tar
go-tangerine-863d166c7b0250cf2e99c8aad69578cdd144d386.tar.gz
go-tangerine-863d166c7b0250cf2e99c8aad69578cdd144d386.tar.bz2
go-tangerine-863d166c7b0250cf2e99c8aad69578cdd144d386.tar.lz
go-tangerine-863d166c7b0250cf2e99c8aad69578cdd144d386.tar.xz
go-tangerine-863d166c7b0250cf2e99c8aad69578cdd144d386.tar.zst
go-tangerine-863d166c7b0250cf2e99c8aad69578cdd144d386.zip
Merge pull request #3043 from fjl/windows-fix-fatalf
cmd/utils: don't check for stderr redirect on windows
-rw-r--r--cmd/utils/cmd.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index 3b521a0e1..584afc804 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -23,6 +23,7 @@ import (
"os"
"os/signal"
"regexp"
+ "runtime"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
@@ -52,10 +53,16 @@ func openLogFile(Datadir string, filename string) *os.File {
// is redirected to a different file.
func Fatalf(format string, args ...interface{}) {
w := io.MultiWriter(os.Stdout, os.Stderr)
- outf, _ := os.Stdout.Stat()
- errf, _ := os.Stderr.Stat()
- if outf != nil && errf != nil && os.SameFile(outf, errf) {
- w = os.Stderr
+ if runtime.GOOS == "windows" {
+ // The SameFile check below doesn't work on Windows.
+ // stdout is unlikely to get redirected though, so just print there.
+ w = os.Stdout
+ } else {
+ outf, _ := os.Stdout.Stat()
+ errf, _ := os.Stderr.Stat()
+ if outf != nil && errf != nil && os.SameFile(outf, errf) {
+ w = os.Stderr
+ }
}
fmt.Fprintf(w, "Fatal: "+format+"\n", args...)
logger.Flush()