Skip to content

Commit

Permalink
chore: Disable progress bar when stdout is not a tty
Browse files Browse the repository at this point in the history
  • Loading branch information
janjurca committed Jun 19, 2024
1 parent 62b35b3 commit e1688ef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/filestorm/utils/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class ProgressBar {
__VA_ARGS__; \
logger->flush(); \
m_progress_bar->print_bar(); \
} else { \
__VA_ARGS__; \
} \
} else { \
__VA_ARGS__; \
Expand Down Expand Up @@ -88,6 +90,10 @@ class FilestormLogger {

void set_progress_bar(ProgressBar *progress_bar) {
m_progress_bar = progress_bar;
if (!isatty(fileno(stdout))) {
m_progress_bar->disable();
warn("Progress bar disabled because stdout is not a tty");
}
logger->flush();
}
};
Expand Down

0 comments on commit e1688ef

Please sign in to comment.