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.
pull/8076/head
Kevin Bracey 2018-09-10 11:15:51 +03:00
parent 78f4b4bc82
commit d05c60ee3f
1 changed files with 2 additions and 0 deletions

View File

@ -1250,6 +1250,8 @@ extern "C" void exit(int return_code)
#if MBED_CONF_PLATFORM_STDIO_FLUSH_AT_EXIT
fflush(stdout);
fflush(stderr);
fsync(STDOUT_FILENO);
fsync(STDERR_FILENO);
#endif
#endif