File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ use lighthouse_version::VERSION;
2020use logging:: { build_workspace_filter, crit, MetricsLayer } ;
2121use malloc_utils:: configure_memory_allocator;
2222use std:: backtrace:: Backtrace ;
23+ use std:: io:: IsTerminal ;
2324use std:: path:: PathBuf ;
2425use std:: process:: exit;
2526use std:: sync:: LazyLock ;
@@ -521,10 +522,15 @@ fn run<E: EthSpec>(
521522
522523 let log_format = matches. get_one :: < String > ( "log-format" ) ;
523524
524- let log_color = matches
525- . get_one :: < bool > ( "log-color" )
526- . copied ( )
527- . unwrap_or ( true ) ;
525+ let log_color = if std:: io:: stdin ( ) . is_terminal ( ) {
526+ matches
527+ . get_one :: < bool > ( "log-color" )
528+ . copied ( )
529+ . unwrap_or ( true )
530+ } else {
531+ // Disable color when in non-interactive mode.
532+ false
533+ } ;
528534
529535 let logfile_color = matches. get_flag ( "logfile-color" ) ;
530536
You can’t perform that action at this time.
0 commit comments