Committed by
GitHub
Flush the stdout buffer after logging to console
Normally if the stdout is connected to a PTY, the stdout buffer is flushed automatically after each \n. However if I run SRS under Docker, the stdout is not connected to a PTY (unless I ask it to), causing the last log line to be incomplete (showing only half). By adding fflush, we could make sure each log line is completely shown, whenever the stdout is connected to a PTY or not.
正在显示
1 个修改的文件
包含
1 行增加
和
0 行删除
@@ -382,6 +382,7 @@ void SrsFastLog::write_log(int& fd, char *str_log, int size, int level) | @@ -382,6 +382,7 @@ void SrsFastLog::write_log(int& fd, char *str_log, int size, int level) | ||
382 | } else{ | 382 | } else{ |
383 | printf("\033[31m%.*s\033[0m", size, str_log); | 383 | printf("\033[31m%.*s\033[0m", size, str_log); |
384 | } | 384 | } |
385 | + fflush(stdout); | ||
385 | 386 | ||
386 | return; | 387 | return; |
387 | } | 388 | } |
-
请 注册 或 登录 后发表评论