Skip to content

Commit 73ab8cc

Browse files
committed
Add fsync for windows, i.e. _commit. See dce8876
1 parent dce8876 commit 73ab8cc

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

unix/file.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
#include "runtime.h"
4040
#include "stream.h"
4141

42+
#ifdef _WIN32
43+
#define fsync _commit
44+
#endif
45+
4246
typedef struct _mp_obj_fdfile_t {
4347
mp_obj_base_t base;
4448
int fd;
@@ -83,12 +87,9 @@ STATIC mp_int_t fdfile_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int
8387
}
8488

8589
STATIC mp_obj_t fdfile_flush(mp_obj_t self_in) {
86-
#ifndef _WIN32
8790
mp_obj_fdfile_t *self = self_in;
91+
check_fd_is_open(self);
8892
fsync(self->fd);
89-
#else
90-
//TODO
91-
#endif
9293
return mp_const_none;
9394
}
9495
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_flush_obj, fdfile_flush);

0 commit comments

Comments
 (0)