Windows: avoid uv_guess_handle crash in when fd < 0
Happens only when using a debug version of the crt.
This commit is contained in:
parent
1ac71a31e9
commit
f43f1a7016
@ -27,9 +27,15 @@
|
||||
|
||||
|
||||
uv_handle_type uv_guess_handle(uv_file file) {
|
||||
HANDLE handle = (HANDLE) _get_osfhandle(file);
|
||||
HANDLE handle;
|
||||
DWORD mode;
|
||||
|
||||
if (file < 0) {
|
||||
return UV_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
handle = (HANDLE) _get_osfhandle(file);
|
||||
|
||||
switch (GetFileType(handle)) {
|
||||
case FILE_TYPE_CHAR:
|
||||
if (GetConsoleMode(handle, &mode)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user