Create a small wrapper for setenv() for portability to Windows

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Closed

#178

@coryan

Description

Some of our tests need to set environment variables. We need a wrapper for ::setenv() as this is a Unix specific call. h/t @mbrukman that we can use this trick from abseil:

#ifdef WIN32
#include <windows.h>
#endif

#ifdef WIN32
      SetEnvironmentVariable(...);
#else
      setenv(...);
#endif