aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-09-03 02:05:30 +0800
committerYuqian Yang <crupest@crupest.life>2025-09-03 02:05:30 +0800
commitf6c36037edc3f1293f96e84691136c657ca488dc (patch)
tree0249461b362e0899bdb07e7e37f41a53960b21a6
parent948fef53cefe6a7186fab29d9ad2e9838d702912 (diff)
downloadcru-f6c36037edc3f1293f96e84691136c657ca488dc.tar.gz
cru-f6c36037edc3f1293f96e84691136c657ca488dc.tar.bz2
cru-f6c36037edc3f1293f96e84691136c657ca488dc.zip
Fix subprocess OSX compile error.
-rw-r--r--src/base/platform/unix/PosixSpawnSubProcess.cpp6
-rw-r--r--test/common/platform/unix/UnixFileStreamTest.cpp2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/base/platform/unix/PosixSpawnSubProcess.cpp b/src/base/platform/unix/PosixSpawnSubProcess.cpp
index 25e6c38c..34ae6622 100644
--- a/src/base/platform/unix/PosixSpawnSubProcess.cpp
+++ b/src/base/platform/unix/PosixSpawnSubProcess.cpp
@@ -103,9 +103,9 @@ void PosixSpawnSubProcessImpl::PlatformCreateProcess(
u"Failed to call posix_spawnattr_init.");
Guard attr_guard([&attr] { posix_spawnattr_destroy(&attr); });
-#ifdef CRU_PLATFORM_OSX
- error = posix_spawnattr_setflags(&attr, POSIX_SPAWN_CLOEXEC_DEFAULT);
- check_error(u"Failed to set flag POSIX_SPAWN_CLOEXEC_DEFAULT (osx).");
+#ifdef __APPLE__
+ check_error(posix_spawnattr_setflags(&attr, POSIX_SPAWN_CLOEXEC_DEFAULT),
+ u"Failed to set flag POSIX_SPAWN_CLOEXEC_DEFAULT (osx).");
#endif
auto exe = start_info.program.ToUtf8();
diff --git a/test/common/platform/unix/UnixFileStreamTest.cpp b/test/common/platform/unix/UnixFileStreamTest.cpp
index fa99aa29..417fccc2 100644
--- a/test/common/platform/unix/UnixFileStreamTest.cpp
+++ b/test/common/platform/unix/UnixFileStreamTest.cpp
@@ -13,7 +13,7 @@ TEST_CASE("UnixFileStream Work", "[stream]") {
auto temp_file_path =
(std::filesystem::temp_directory_path() / "cru_test_temp.XXXXXX")
.generic_string();
- mktemp(temp_file_path.data());
+ mkstemp(temp_file_path.data());
UnixFileStream file(temp_file_path.c_str(), O_WRONLY | O_CREAT);
file.Write("abc", 3);