Skip to content

Commit 3cdb2e9

Browse files
authored
Change syscall to os in terminal check for Windows compatibility (#55)
* Fix terminal check for Windows * Replace syscall with os call fro compatibility
1 parent e6e2cf0 commit 3cdb2e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

diff.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package main
33
import (
44
"bytes"
55
"fmt"
6+
"os"
67
"strings"
7-
"syscall"
88

99
"github.com/pmezard/go-difflib/difflib"
1010
"golang.org/x/crypto/ssh/terminal"
@@ -36,7 +36,7 @@ func PrettyDiff(path string, contents []byte, results []byte) error {
3636
for _, line := range strings.Split(text, "\n") {
3737
line = strings.TrimRight(line, " ")
3838
switch {
39-
case !terminal.IsTerminal(syscall.Stdout) && len(line) > 0:
39+
case !terminal.IsTerminal(int(os.Stdout.Fd())) && len(line) > 0:
4040
fmt.Printf("%s\n", line)
4141
case strings.HasPrefix(line, "+"):
4242
fmt.Printf("%s%s%s\n", ansiGreen, line, ansiEnd)

0 commit comments

Comments
 (0)