Move declaration of kStdOutFileNo and kStdErrFileno
Move declaration of kStdOutFileNo and kStdErrFileno closer to where they are used to avoid having to guard for GTEST_HAS_STREAM_REDIRECTION twice
This commit is contained in:
parent
900c3f9cd5
commit
fe735a6986
@ -90,17 +90,6 @@
|
|||||||
namespace testing {
|
namespace testing {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
#if GTEST_HAS_STREAM_REDIRECTION
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
|
||||||
// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
|
|
||||||
const int kStdOutFileno = 1;
|
|
||||||
const int kStdErrFileno = 2;
|
|
||||||
#else
|
|
||||||
const int kStdOutFileno = STDOUT_FILENO;
|
|
||||||
const int kStdErrFileno = STDERR_FILENO;
|
|
||||||
#endif // _MSC_VER
|
|
||||||
#endif // GTEST_HAS_STREAM_REDIRECTION
|
|
||||||
|
|
||||||
#if GTEST_OS_LINUX || GTEST_OS_GNU_HURD
|
#if GTEST_OS_LINUX || GTEST_OS_GNU_HURD
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -1179,6 +1168,15 @@ static std::string GetCapturedStream(CapturedStream** captured_stream) {
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
|
// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
|
||||||
|
const int kStdOutFileno = 1;
|
||||||
|
const int kStdErrFileno = 2;
|
||||||
|
#else
|
||||||
|
const int kStdOutFileno = STDOUT_FILENO;
|
||||||
|
const int kStdErrFileno = STDERR_FILENO;
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
// Starts capturing stdout.
|
// Starts capturing stdout.
|
||||||
void CaptureStdout() {
|
void CaptureStdout() {
|
||||||
CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);
|
CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);
|
||||||
|
Loading…
Reference in New Issue
Block a user