Hmm. I am a bit surprised here.. It seems to me that we should make sure that: - We exist quickly if _get_osfhandle() returns -2 or INVALID_HANDLE_VALUE, returning EINVAL? - After GetFileType(), check for GetLastError() and the FILE_TYPE_UNKNOWN case?
Do you think that these would be improvements?
IDK, this is just looking for the good case, anything else we'll fail with ESPIPE or EINVAL anyway. If we want to get the proper file type we can call fstat(), which has the full logic.