mirror of
https://github.com/google/googletest.git
synced 2025-12-06 16:57:00 +08:00
Use TempDir() in CapturedStream on all non‐Windows platforms
This is more consistent and makes tests using output capture behave as expected in environments with custom values of `$TEST_TMPDIR` or `$TMPDIR`, including fixing them in ones where `/tmp` may not be accessible, such as sandboxed build environments on macOS.
This commit is contained in:
parent
4ef9218150
commit
7a60b1abe8
@ -1076,13 +1076,7 @@ class CapturedStream {
|
|||||||
#else
|
#else
|
||||||
// There's no guarantee that a test has write access to the current
|
// There's no guarantee that a test has write access to the current
|
||||||
// directory, so we create the temporary file in a temporary directory.
|
// directory, so we create the temporary file in a temporary directory.
|
||||||
std::string name_template;
|
std::string name_template = TempDir();
|
||||||
|
|
||||||
#if defined(GTEST_OS_LINUX_ANDROID) || defined(GTEST_OS_IOS)
|
|
||||||
name_template = TempDir();
|
|
||||||
#else
|
|
||||||
name_template = "/tmp/";
|
|
||||||
#endif
|
|
||||||
name_template.append("gtest_captured_stream.XXXXXX");
|
name_template.append("gtest_captured_stream.XXXXXX");
|
||||||
|
|
||||||
// mkstemp() modifies the string bytes in place, and does not go beyond the
|
// mkstemp() modifies the string bytes in place, and does not go beyond the
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user