JuliaLang / PackageCompiler.jl

Compile your Julia Package
https://julialang.github.io/PackageCompiler.jl/dev/
MIT License
1.41k stars 189 forks source link

Printing spinners and progress bars breaks in non-interactive terminals #953

Open robpallotta opened 1 month ago

robpallotta commented 1 month ago

When running PackageCompiler in a non-interactive terminal (e.g. emacs shell-mode), the printing of animated spinners and progress bars does not overwrite previous frames, resulting in the spinner/bar frames filling the entire terminal output. PackageCompiler should either check that the current terminal supports printing back over previous lines (e.g by checking the TERM environment variable) or should provide users a way to disable the printing of animated spinners and progress bars (e.g. with a flag like --progress=plain or similar). Currently, the only way to not overload the terminal output is to redirect all output to /dev/null, which is not practical because it also hides all the useful messages (e.g. error logs etc.).

I have found two places where this occurs; one is the progress bar and half-filled circle spinner when compiling dependencies, the other is the 6-dots spinner when compiling sysimages.

Example output from a non-interactive terminal:

⠋ [00m:00s] PackageCompiler: creating compiler .ji image (incremental=false)⠙ [00m:00s] PackageCompiler: creating compiler .ji image (incremental=false) ...long line trunctated
⠋ [00m:00s] PackageCompiler: compiling fresh sysimage (incremental=false)⠙ [00m:00s] PackageCompiler: compiling fresh sysimage (incremental=false) ...long line trunctated
[pid 1636] waiting for IO to finish:
 Handle type        uv_handle_t->data
 timer              0x1748e170->0x7fc81f1b69b0
⠇ [01m:08s] PackageCompiler: compiling fresh sysimage (incremental=false)⠋ [01m:08s] PackageCompiler: compiling fresh sysimage (incremental=false) ...long line trunctated
[pid 1636] waiting for IO to finish:
 Handle type        uv_handle_t->data
 timer              0x1748e170->0x7fc81f1b69b0
⣄ [01m:23s] PackageCompiler: compiling fresh sysimage (incremental=false)⡆ [01m:23s] PackageCompiler: compiling fresh sysimage (incremental=false) ...long line trunctated
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/nT5sD/src/PackageCompiler.jl:180
⢰ [02m:15s] PackageCompiler: compiling fresh sysimage (incremental=false)⣠ [02m:15s] PackageCompiler: compiling fresh sysimage (incremental=false) ...long line trunctated
Precompiling project...
  Progress [>                                        ]  0/22
  ◐ Glob
  ◑ EnumX
  ◐ Compat
  ◓ TextWrap
  ◓ TranscodingStreams
  ◑ InlineStrings
  ◓ TZJData
  ◓ Preferences
  ◐ Scratch
  Progress [>                                        ]  0/22
  ◓ Glob
  ◒ EnumX
  ◓ Compat
  ◑ TextWrap
  ◑ TranscodingStreams
  ◒ InlineStrings
  ◑ TZJData
  ◑ Preferences
  ◓ Scratch
  Progress [==>                                      ]  1/22
  ◑ Glob
  ◐ EnumX
  ◑ Compat
  ✓ TextWrap
  ◒ TranscodingStreams
  ◐ InlineStrings
  ◒ TZJData
  ◒ Preferences
  ◑ Scratch
  ◓ BufferedStreams