Skip to content

Commit

Permalink
Merge pull request #153 from djdv/fix/win-stdio
Browse files Browse the repository at this point in the history
cli: don't sync output to NUL on Windows
  • Loading branch information
Stebalien authored Mar 4, 2019
2 parents 0dedcef + f6962d2 commit b21055c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cli/error_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import (
"syscall"
)

const invalid_file_handle syscall.Errno = 0x6
const (
invalid_file_handle syscall.Errno = 0x6 // console output is not buffered on this platform
invalid_handle_function syscall.Errno = 0x1 // this is specifically returned when NUL is the FlushFileBuffers target
)

func isErrnoNotSupported(err error) bool {
switch err {
case syscall.EINVAL, syscall.ENOTSUP, syscall.ENOTTY, invalid_file_handle:
case syscall.EINVAL, syscall.ENOTSUP, syscall.ENOTTY, invalid_file_handle, invalid_handle_function:
return true
}
return false
Expand Down

0 comments on commit b21055c

Please sign in to comment.