Ignore return value of getchar when waiting for keypress

Previously this was causing warnings under MSVC for ignored return
value.
This commit is contained in:
Martin Hořeňovský 2017-08-22 22:00:52 +02:00
parent cb2fceb119
commit a7a9be59ff

View File

@ -201,12 +201,12 @@ namespace Catch {
int run() { int run() {
if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) { if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {
Catch::cout() << "...waiting for enter/ return before starting" << std::endl; Catch::cout() << "...waiting for enter/ return before starting" << std::endl;
std::getchar(); static_cast<void>(std::getchar());
} }
int exitCode = runInternal(); int exitCode = runInternal();
if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) { if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {
Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl; Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl;
std::getchar(); static_cast<void>(std::getchar());
} }
return exitCode; return exitCode;
} }