Permalink
Browse files

fix #235, erroric console output, status message overwrite

using alternative message style
otherwise ncurses/terminal codes for cursor position would seem necessary

(cherry picked from commit 2d1a632)
  • Loading branch information...
1 parent ee43895 commit 2d1042d4792eea2166e13eff7d3a20df2432515c @ConorOG ConorOG committed with DarthGandalf Jan 1, 2014
Showing with 5 additions and 14 deletions.
  1. +5 −14 src/Utils.cpp
View
@@ -306,29 +306,20 @@ void CUtils::PrintMessage(const CString& sMessage, bool bStrong) {
void CUtils::PrintAction(const CString& sMessage) {
if (CDebug::StdoutIsTTY())
- fprintf(stdout, "\033[1m\033[34m[\033[32m \033[34m]\033[39m\033[22m %s... ", sMessage.c_str());
+ fprintf(stdout, "\033[1m\033[34m[ .. \033[34m]\033[39m\033[22m %s...\n", sMessage.c_str());
else
fprintf(stdout, "%s... ", sMessage.c_str());
fflush(stdout);
}
void CUtils::PrintStatus(bool bSuccess, const CString& sMessage) {
if (CDebug::StdoutIsTTY()) {
- if (!sMessage.empty()) {
- if (bSuccess) {
- fprintf(stdout, "%s", sMessage.c_str());
- } else {
- fprintf(stdout, "\033[1m\033[34m[\033[31m %s \033[34m]"
- "\033[39m\033[22m", sMessage.c_str());
- }
- }
-
- fprintf(stdout, "\r");
-
if (bSuccess) {
- fprintf(stdout, "\033[1m\033[34m[\033[32m ok \033[34m]\033[39m\033[22m\n");
+ fprintf(stdout, "\033[1m\033[34m[\033[32m ok \033[34m]\033[39m\033[22m");
+ fprintf(stdout, " %s\n", sMessage.empty() ? "ok" : sMessage.c_str());
} else {
- fprintf(stdout, "\033[1m\033[34m[\033[31m !! \033[34m]\033[39m\033[22m\n");
+ fprintf(stdout, "\033[1m\033[34m[\033[31m !! \033[34m]\033[39m\033[22m");
+ fprintf(stdout, "\033[1m\033[31m %s\n", sMessage.empty() ? "failed" : sMessage.c_str());
}
} else {
if (bSuccess) {

0 comments on commit 2d1042d

Please sign in to comment.