You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for your efforts in creating this great lib! It saved a lot of time for me.
Unfortunately, I think I found a bug. I tried to create several progress bars in my Spring Shell application sequentially but I faced with issue in cmd and PowerShell on Windows: after closing the first progress bar the width of each newly created one reduced, moreover, I wasn't able to print messages in terminal. While investigation I dived into progress bar's source code and found that library is closing the terminal when progress is finished.
classProgressUpdateActionimplementsRunnable {
//...publicvoidrun() {
if (first) {
forceRefresh();
first = false;
}
else {
if (!progress.paused) refresh();
if (!progress.alive) {
forceRefresh();
consumer.close();
TerminalUtils.closeTerminal();
}
}
}
//...
}
When it is closed each new creation of progress bar will also create dumb terminal using TerminalUtils.getTerminal(). Therefore the width is changing. And as initial terminal is closed output stream is also becoming to be closed (I assume it closes the System.out too so that is why I couldn't print anything even to there).
I downloaded the source code and removed TerminalUtils.closeTerminal(); line, built library locally and everything worked fine. Not closing the terminal also allows user to use terminal's output stream so user can change color of he's text and print messages to one output stream instead of printing via System.err. I would suggest to remove this line in the library too. Also maybe it would be good to mention in docs that user has to close Terminal by his own
The text was updated successfully, but these errors were encountered:
Creating progress bars sequentially might be a problem if the prior one is not yet closed and another Terminal is created. Can you try adding synchronized to TerminalUtils.getTerminal() method to see if it resolves your problem?
Hello.
Thank you for your efforts in creating this great lib! It saved a lot of time for me.
Unfortunately, I think I found a bug. I tried to create several progress bars in my Spring Shell application sequentially but I faced with issue in cmd and PowerShell on Windows: after closing the first progress bar the width of each newly created one reduced, moreover, I wasn't able to print messages in terminal. While investigation I dived into progress bar's source code and found that library is closing the terminal when progress is finished.
When it is closed each new creation of progress bar will also create dumb terminal using
TerminalUtils.getTerminal()
. Therefore the width is changing. And as initial terminal is closed output stream is also becoming to be closed (I assume it closes the System.out too so that is why I couldn't print anything even to there).I downloaded the source code and removed
TerminalUtils.closeTerminal();
line, built library locally and everything worked fine. Not closing the terminal also allows user to use terminal's output stream so user can change color of he's text and print messages to one output stream instead of printing via System.err. I would suggest to remove this line in the library too. Also maybe it would be good to mention in docs that user has to close Terminal by his ownThe text was updated successfully, but these errors were encountered: