-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from ipfs/fix/sync-stderr-windows
cli: fix ignoring std{out,err} sync errors on windows
- Loading branch information
Showing
4 changed files
with
51 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cli | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
func isSyncNotSupportedErr(err error) bool { | ||
perr, ok := err.(*os.PathError) | ||
if !ok { | ||
return false | ||
} | ||
return perr.Op == "sync" && isErrnoNotSupported(perr.Err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//+build !windows | ||
|
||
package cli | ||
|
||
import ( | ||
"syscall" | ||
) | ||
|
||
func isErrnoNotSupported(err error) bool { | ||
switch err { | ||
case syscall.EINVAL, syscall.ENOTSUP: | ||
return true | ||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//+build windows | ||
|
||
package cli | ||
|
||
import ( | ||
"syscall" | ||
) | ||
|
||
const invalid_file_handle syscall.Errno = 0x6 | ||
|
||
func isErrnoNotSupported(err error) bool { | ||
switch err { | ||
case syscall.EINVAL, syscall.ENOTSUP, invalid_file_handle: | ||
return true | ||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters