Skip to content

Commit

Permalink
Fix terminal output for progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianTM committed Aug 15, 2024
1 parent 8140d03 commit 5b4963f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ void Log::messageHandler(QtMsgType type, const QMessageLogContext &, const QStri
{
QTextStream term_out(stdout);

// Avoid saving endless mksquashfs output
if (msg.startsWith('\r') || msg.startsWith("\033[2K")) {
term_out << msg;
return;
// Check if the message contains carriage return or starts with the escape sequence for clearing the line
if (msg.contains('\r') || msg.startsWith("\033[2K")) {
term_out << "\033[?25l" << msg;
return; // Skip writing to the log file
}

term_out << msg << '\n';
Expand Down
2 changes: 1 addition & 1 deletion work.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void Work::cleanUp()
initrd_dir.remove();
exit(EXIT_SUCCESS);
}
emit message(tr("Cleaning..."));
emit message(tr("Cleaning...") + "\033[?25h"); // Restore the cursor visibility
Cmd().run(elevate + " /usr/lib/" + QCoreApplication::applicationName() + "/snapshot-lib kill_mksquashfs", true);
shell.close();
QProcess::execute("sync", {});
Expand Down

0 comments on commit 5b4963f

Please sign in to comment.