Skip to content

Commit

Permalink
extmod/vfs_posix_file: Fix flush handling in msvc builds.
Browse files Browse the repository at this point in the history
Flushing console output in msvc builds always fails because that
output is not buffered so don't propagate that as an error (in a
simlar way as was done in 1c04774 for macOS).
  • Loading branch information
stinos committed Oct 3, 2023
1 parent d6c55a4 commit d875b06
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion extmod/vfs_posix_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ STATIC mp_uint_t vfs_posix_file_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_
// fsync(stdin/stdout/stderr) may fail with EINVAL (or ENOTSUP on macos),
// but don't propagate that error out. Because data is not buffered by
// us, and stdin/out/err.flush() should just be a no-op.
#ifdef __APPLE__
#if defined(__APPLE__)
#define VFS_POSIX_STREAM_STDIO_ERR_CATCH (err == EINVAL || err == ENOTSUP)
#elif defined(_MSC_VER)
#define VFS_POSIX_STREAM_STDIO_ERR_CATCH (err == EINVAL || err == EBADF)
#else
#define VFS_POSIX_STREAM_STDIO_ERR_CATCH (err == EINVAL)
#endif
Expand Down

0 comments on commit d875b06

Please sign in to comment.