[lldb] Inherit host environment when running shell commands

Summary:
On most hosts we were running shell commands with an empty environment.
The only exception was windows, which was inheriting the host enviroment
mostly by accident.

Running the commands in an empty environment does not sound like a
sensible default, so this patch changes Host::RunShellCommand to inherit
the host environment.  This impacts both commands run via
SBPlatform::Run (in case of host platforms), as well as the "platform
shell" CLI command.

Reviewers: jingham, friss

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D77123
This commit is contained in:
Pavel Labath
2020-03-31 10:47:20 +02:00
parent 9be4be3e53
commit 0ec88d031a
4 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
#include <cstdlib>
#include <cstdio>
int main() {
printf("MY_TEST_ENV_VAR=%s\n", getenv("MY_TEST_ENV_VAR"));
return 0;
}