[libcxx-commits] [PATCH] D89681: [libcxx] [test] Use _putenv instead of setenv on windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 19 02:53:08 PDT 2020


mstorsjo created this revision.
mstorsjo added a reviewer: libc++.
Herald added a project: libc++.
Herald added 1 blocking reviewer(s): libc++.
mstorsjo requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89681

Files:
  libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp


Index: libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
+++ libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
@@ -26,11 +26,19 @@
 using namespace fs;
 
 void PutEnv(std::string var, fs::path value) {
+#ifdef _WIN32
+    assert(::_putenv((var + "=" + value.string()).c_str()) == 0);
+#else
     assert(::setenv(var.c_str(), value.string().c_str(), /* overwrite */ 1) == 0);
+#endif
 }
 
 void UnsetEnv(std::string var) {
+#ifdef _WIN32
+    assert(::_putenv((var + "=").c_str()) == 0);
+#else
     assert(::unsetenv(var.c_str()) == 0);
+#endif
 }
 
 TEST_SUITE(filesystem_temp_directory_path_test_suite)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89681.298976.patch
Type: text/x-patch
Size: 883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201019/8d347385/attachment.bin>


More information about the libcxx-commits mailing list