diff --git a/apps/wolfssh/wolfssh.c b/apps/wolfssh/wolfssh.c index 9686f0c2..afad5189 100644 --- a/apps/wolfssh/wolfssh.c +++ b/apps/wolfssh/wolfssh.c @@ -1422,8 +1422,16 @@ int main(int argc, char** argv) /* Close the log last, wolfSSH_Cleanup() still logs and the callback * cannot be uninstalled. */ if (logFileStream != NULL) { +#ifdef _MSC_VER + /* The terminal session's input thread is left running, it blocks in + * a console read with nothing to cancel it. Flush the log and let + * process exit close it, rather than close the stream out from under + * a write that thread is making. */ + WFFLUSH(logFileStream); +#else WFCLOSE(NULL, logFileStream); logFileStream = NULL; +#endif } config_cleanup(&clientConfig);