diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-06-19 17:23:54 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-06-19 17:23:54 +0000 |
commit | 4853a503371f39aa22e14adcdecea71c09841e34 (patch) | |
tree | b16ed6470fbbc4ea8eace7f836ae8e6448a369a3 /src/gtest-port.cc | |
parent | ae3247986bbbafcc913b5fe6132090ad6f1c3f36 (diff) | |
download | googletest-4853a503371f39aa22e14adcdecea71c09841e34.tar.gz googletest-4853a503371f39aa22e14adcdecea71c09841e34.tar.bz2 googletest-4853a503371f39aa22e14adcdecea71c09841e34.zip |
Fixes compatibility with Windows CE and Symbian (By Tim Baverstock and Mika).
Diffstat (limited to 'src/gtest-port.cc')
-rw-r--r-- | src/gtest-port.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gtest-port.cc b/src/gtest-port.cc index 7f6db79f..bc6d8f80 100644 --- a/src/gtest-port.cc +++ b/src/gtest-port.cc @@ -36,8 +36,10 @@ #include <stdio.h> #if GTEST_OS_WINDOWS +#ifndef _WIN32_WCE #include <io.h> #include <sys/stat.h> +#endif // _WIN32_WCE #else #include <unistd.h> #endif // GTEST_OS_WINDOWS @@ -425,7 +427,7 @@ void GTestLog(GTestLogSeverity severity, const char* file, fprintf(stderr, "\n%s %s:%d: %s\n", marker, file, line, msg); if (severity == GTEST_FATAL) { fflush(NULL); // abort() is not guaranteed to flush open file streams. - abort(); + posix::Abort(); } } @@ -444,6 +446,10 @@ class CapturedStderr { public: // The ctor redirects stderr to a temporary file. CapturedStderr() { +#ifdef _WIN32_WCE + // Not supported on Windows CE. + posix::Abort(); +#else uncaptured_fd_ = dup(kStdErrFileno); #if GTEST_OS_WINDOWS @@ -465,19 +471,24 @@ class CapturedStderr { fflush(NULL); dup2(captured_fd, kStdErrFileno); close(captured_fd); +#endif // _WIN32_WCE } ~CapturedStderr() { +#ifndef _WIN32_WCE remove(filename_.c_str()); +#endif // _WIN32_WCE } // Stops redirecting stderr. void StopCapture() { +#ifndef _WIN32_WCE // Restores the original stream. fflush(NULL); dup2(uncaptured_fd_, kStdErrFileno); close(uncaptured_fd_); uncaptured_fd_ = -1; +#endif // !_WIN32_WCE } // Returns the name of the temporary file holding the stderr output. |