Skip to content

Commit

Permalink
SKALED-1623 Remove coloring
Browse files Browse the repository at this point in the history
  • Loading branch information
dimalit committed Nov 15, 2023
1 parent e7c9f4f commit e47968b
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions libdevcore/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,15 @@ void ExitHandler::exitHandler( int nSignalNo, ExitHandler::exit_code_t ec ) {
std::string strMessagePrefix;
if ( nSignalNo > 0 ) {
strMessagePrefix = ( ExitHandler::shouldExit() && s_nStopSignal > 0 ) ?
cc::error( "\nStop flag was already raised on. " ) +
cc::fatal( "WILL FORCE TERMINATE." ) +
cc::error( " Caught (second) signal. " ) :
cc::error( "\nCaught (first) signal. " );
string( "\nStop flag was already raised on. " ) +
"WILL FORCE TERMINATE." + " Caught (second) signal. " :
"\nCaught (first) signal. ";
} else {
strMessagePrefix = ExitHandler::shouldExit() ?
cc::error( "\nInternal exit requested while already exiting. " ) :
cc::error( "\nInternal exit initiated. " );
string( "\nInternal exit requested while already exiting. " ) :
"\nInternal exit initiated. ";
}
std::cerr << strMessagePrefix << cc::error( skutils::signal::signal2str( nSignalNo ) )
<< "\n\n";
std::cerr.flush();
std::cerr << strMessagePrefix << skutils::signal::signal2str( nSignalNo ) << "\n\n";

switch ( nSignalNo ) {
case SIGINT:
Expand Down Expand Up @@ -109,10 +106,10 @@ void ExitHandler::exitHandler( int nSignalNo, ExitHandler::exit_code_t ec ) {
auto start_time = std::chrono::steady_clock::now();

std::thread( [nSignalNo, start_time]() {
std::cerr << ( "\n" + cc::fatal( "SELF-KILL:" ) + " " + cc::error( "Will sleep " ) +
cc::size10( ExitHandler::KILL_TIMEOUT ) +
cc::error( " seconds before force exit..." ) + "\n\n" );
std::cerr.flush();
std::cerr << ( "\n" + string( "SELF-KILL:" ) + " " + "Will sleep " +
cc::size10( ExitHandler::KILL_TIMEOUT ) +
" seconds before force exit..." ) +
"\n\n";

clog( VerbosityInfo, "exit" ) << "THREADS timer started";

Expand Down Expand Up @@ -140,11 +137,10 @@ void ExitHandler::exitHandler( int nSignalNo, ExitHandler::exit_code_t ec ) {
std::this_thread::sleep_for( 100ms );
}

std::cerr << ( "\n" + cc::fatal( "SELF-KILL:" ) + " " +
cc::error( "Will force exit after sleeping " ) +
std::cerr << ( "\n" + string( "SELF-KILL:" ) + " " +
"Will force exit after sleeping " +
cc::size10( ExitHandler::KILL_TIMEOUT ) + cc::error( " second(s)" ) +
"\n\n" );
std::cerr.flush();

// TODO deduplicate this with main() before return
ExitHandler::exit_code_t ec = ExitHandler::requestedExitCode();
Expand All @@ -162,8 +158,7 @@ void ExitHandler::exitHandler( int nSignalNo, ExitHandler::exit_code_t ec ) {

// TODO deduplicate with first if()
if ( ExitHandler::shouldExit() && s_nStopSignal > 0 && nSignalNo > 0 ) {
std::cerr << ( "\n" + cc::fatal( "SIGNAL-HANDLER:" ) + " " +
cc::error( "Will force exit now..." ) + "\n\n" );
std::cerr << ( "\n" + string( "SIGNAL-HANDLER:" ) + " " + "Will force exit now...\n\n" );
_exit( 13 );
}

Expand Down

0 comments on commit e47968b

Please sign in to comment.