From 1b403b82d79197e07103a313fe2e611c86cc7c8d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 28 Nov 2024 14:39:49 +0100 Subject: [PATCH] Handle setting environment on Windows --- passes/cmds/setenv.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/passes/cmds/setenv.cc b/passes/cmds/setenv.cc index 7d791cf7671..7593152a297 100644 --- a/passes/cmds/setenv.cc +++ b/passes/cmds/setenv.cc @@ -41,8 +41,12 @@ struct SetenvPass : public Pass { if(args.size() != 3) log_cmd_error("Wrong number of arguments given.\n"); +#if defined(_WIN32) + _putenv_s(args[1].c_str(), args[2].c_str()); +#else setenv(args[1].c_str(), args[2].c_str(), 1); - +#endif + } } SetenvPass;