@@ -51,29 +51,39 @@ BOOST_AUTO_TEST_CASE(run_command)
5151 }
5252 {
5353 // An invalid command is handled by Boost
54+ #ifdef __MINGW64__
55+ constexpr int expected_error{6 };
56+ #else
57+ constexpr int expected_error{2 };
58+ #endif
5459 BOOST_CHECK_EXCEPTION (RunCommandParseJSON (" invalid_command" ), boost::process::process_error, [&](const boost::process::process_error& e) {
5560 BOOST_CHECK (std::string (e.what ()).find (" RunCommandParseJSON error:" ) == std::string::npos);
56- BOOST_CHECK_EQUAL (e.code ().value (), 2 );
61+ BOOST_CHECK_EQUAL (e.code ().value (), expected_error );
5762 return true ;
5863 });
5964 }
6065 {
6166 // Return non-zero exit code, no output to stderr
6267#ifdef WIN32
63- const std::string command{" cmd.exe /c call " };
68+ const std::string command{" cmd.exe /c exit 1 " };
6469#else
6570 const std::string command{" false" };
6671#endif
6772 BOOST_CHECK_EXCEPTION (RunCommandParseJSON (command), std::runtime_error, [&](const std::runtime_error& e) {
68- BOOST_CHECK (std::string (e.what ()).find (strprintf (" RunCommandParseJSON error: process(%s) returned 1: \n " , command)) != std::string::npos);
73+ const std::string what (e.what ());
74+ BOOST_CHECK (what.find (strprintf (" RunCommandParseJSON error: process(%s) returned 1: \n " , command)) != std::string::npos);
6975 return true ;
7076 });
7177 }
7278 {
7379 // Return non-zero exit code, with error message for stderr
7480#ifdef WIN32
7581 const std::string command{" cmd.exe /c dir nosuchfile" };
82+ #ifdef _MSC_VER
7683 const std::string expected{" File Not Found" };
84+ #else
85+ const std::string expected{" File not found." };
86+ #endif
7787#else
7888 const std::string command{" ls nosuchfile" };
7989 const std::string expected{" No such file or directory" };
0 commit comments