summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorstijn <stinos@zoho.com>2015-10-30 10:42:34 +0100
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-10-31 14:10:13 +0300
commitbd9f850e859c976780c5dea98756216a050db016 (patch)
tree43c1340de70d0eb7884d64ff022f30786d63dab8
parentd6201fc4b74e78e7eb9cec91c444884df2efbb7c (diff)
downloadmicropython-bd9f850e859c976780c5dea98756216a050db016.tar.gz
micropython-bd9f850e859c976780c5dea98756216a050db016.zip
windows: Use write() instead of fwrite() to avoid out-of-order output.
This fixes the basics/exception_chain.py test, also see #1500 for more info and [4300c7d] where the same change was done for the other ports.
-rw-r--r--windows/mpconfigport.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/windows/mpconfigport.h b/windows/mpconfigport.h
index f4eb01e930..ce5783c9c1 100644
--- a/windows/mpconfigport.h
+++ b/windows/mpconfigport.h
@@ -134,7 +134,8 @@ typedef long mp_off_t;
typedef void *machine_ptr_t; // must be of pointer size
typedef const void *machine_const_ptr_t; // must be of pointer size
-#define MP_PLAT_PRINT_STRN(str, len) fwrite(str, 1, len, stdout)
+#include <unistd.h>
+#define MP_PLAT_PRINT_STRN(str, len) do { int ret = write(1, str, len); (void)ret; } while (0)
extern const struct _mp_obj_fun_builtin_t mp_builtin_input_obj;
extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;