Skip to content

Commit d05c60e

Browse files
committed
Sync output devices on exit
Mbed retarget does an `fflush` on stdout and stderr on exit - this flushes the C library buffers (if it is buffering), but doesn't flush any device buffers (eg UARTSerial's TX buffer). Add sync() calls to the output device to do this.
1 parent 78f4b4b commit d05c60e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

platform/mbed_retarget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,8 @@ extern "C" void exit(int return_code)
12501250
#if MBED_CONF_PLATFORM_STDIO_FLUSH_AT_EXIT
12511251
fflush(stdout);
12521252
fflush(stderr);
1253+
fsync(STDOUT_FILENO);
1254+
fsync(STDERR_FILENO);
12531255
#endif
12541256
#endif
12551257

0 commit comments

Comments
 (0)