gtest's CapturedStream on Linux hardcoded /tmp/ for its temp file without consulting the environment, causing failures in sandboxed environments where /tmp is read-only. Use TempDir() instead, which checks TEST_TMPDIR then TMPDIR and falls back to /tmp/, matching the behavior already present on Android and macOS/iOS. See also upstream PR: https://github.com/google/googletest/pull/4962 Assisted-by: Claude Code