Followup on #3866
TLDR:
- the PMD CLI should automatically disable the progress bar when we can detect that the output is piped.
- this can be done unreliably in Java, and more reliably in shell (although we also have to find a solution for the windows shell)
- if PMD silently adds
--no-progress when it detects a non-interactive shell session, we need to have a --progress switch that explicitly enables the progress bar even in that case.
Original thread:
should we try to be smart and have this off by default when the terminal is not interactive (ie: output is being redirected to a file)?
In Java this can be done checking if System.console() is null, but this is a proxy, as it fails if either the STDOUT or STDIN are not connected to a device… checking solely for STDOUT would require an equivalent to C's isatty, which is unfortunately not available without JNI.
Originally posted by @jsotuyod in #3866 (comment)
Should this maybe be done inside the shell wrapper instead? stackoverflow.com/questions/911168/how-can-i-detect-if-my-shell-script-is-running-through-a-pipe
Followup on #3866
TLDR:
--no-progresswhen it detects a non-interactive shell session, we need to have a--progressswitch that explicitly enables the progress bar even in that case.Original thread:
should we try to be smart and have this off by default when the terminal is not interactive (ie: output is being redirected to a file)?
In Java this can be done checking if
System.console()isnull, but this is a proxy, as it fails if either the STDOUT or STDIN are not connected to a device… checking solely for STDOUT would require an equivalent to C'sisatty, which is unfortunately not available without JNI.Originally posted by @jsotuyod in #3866 (comment)
Should this maybe be done inside the shell wrapper instead? stackoverflow.com/questions/911168/how-can-i-detect-if-my-shell-script-is-running-through-a-pipe