Skip to content

Commit 43d0a6e

Browse files
authored
Merge pull request #53 from thaJeztah/windows_cleanup
windows: GetHandleInfo: combine checks into a single switch
2 parents c99aa98 + 07e1b5f commit 43d0a6e

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

windows/console.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@ func GetHandleInfo(in interface{}) (uintptr, bool) {
1616
return t.Fd(), true
1717
case *ansiWriter:
1818
return t.Fd(), true
19+
case *os.File:
20+
fd := t.Fd()
21+
return fd, isConsole(fd)
22+
default:
23+
return 0, false
1924
}
20-
21-
var inFd uintptr
22-
var isTerminal bool
23-
24-
if file, ok := in.(*os.File); ok {
25-
inFd = file.Fd()
26-
isTerminal = isConsole(inFd)
27-
}
28-
return inFd, isTerminal
2925
}
3026

3127
// IsConsole returns true if the given file descriptor is a Windows Console.

0 commit comments

Comments
 (0)