diff --git a/src/cpp_main.cpp b/src/cpp_main.cpp index 73a1aa9d..a18c4479 100644 --- a/src/cpp_main.cpp +++ b/src/cpp_main.cpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2001-2002. +// (C) Copyright Gennadiy Rozental 2001-2003. // (C) Copyright Beman Dawes 1995-2001. // Permission to copy, use, modify, sell and distribute this software is // granted provided this copyright notice appears in all copies. This software @@ -9,7 +9,7 @@ // // File : $RCSfile$ // -// Version : $Id$ +// Version : $Revision$ // // Description : main function implementation for Program Executon Monitor // *************************************************************************** @@ -64,24 +64,31 @@ int main( int argc, char* argv[] ) try { result = caller.execute( catch_system_errors ); + if( result == 0 ) + result = boost::exit_success; + else if( result != boost::exit_success ) { + std::cout << "\n**** error return code: " << result << std::endl; + result = boost::exit_failure; + } + } + catch( boost::execution_exception const& exex ) { + std::cout << "\n**** exception(" << exex.code() << "): " << exex.what() << std::endl; + result = boost::exit_exception_failure; + } + + if( result != boost::exit_success ) { + std::cerr << "******** errors detected; see standard output for details ********" << std::endl; + } + else { // Some prefer a confirming message when all is well, while others don't - // like the clutter. Use an environmental variable to avoid command + // like the clutter. Use an environment variable to avoid command // line argument modifications; for use in production programs // that's a no-no in some organizations. boost::unit_test_framework::c_string_literal p( std::getenv( "BOOST_PRG_MON_CONFIRM" ) ); if( !p || std::strcmp( p, "no" ) != 0 ) { - std::cout << std::flush << "no errors detected" << std::endl; + std::cerr << std::flush << "no errors detected" << std::endl; } } - catch( boost::execution_exception const& exex ) { - std::cout << "\n*** Error: " << exex.what() << std::endl; - result = exex.code(); - } - - if( result != 0 && result != boost::exit_success ) { - std::cout << "\n**** error return code " << result << std::endl; - std::cerr << "********** errors detected; see standard output for details ***********" << std::endl; - } return result; } @@ -92,13 +99,8 @@ int main( int argc, char* argv[] ) // Revision History : // // $Log$ -// Revision 1.7 2002/12/08 17:58:10 rogeeff -// BOOST_TEST_SYSTEM_ERROS env. variable introduced -// BOOST_CPP_MAIN_CONFIRMATION renamed to BOOST_PRG_MAN_CONFIRM and twicked it's -// logic a bit. It now should have value "no" to turn off pass confirmation -// -// Revision 1.6 2002/11/02 20:04:41 rogeeff -// release 1.29.0 merged into the main trank +// Revision 1.8 2003/06/09 09:12:26 rogeeff +// straiten return code logic for Program Execution Monitor // // ***************************************************************************