This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Inherit host environment when running shell commands
ClosedPublic

Authored by labath on Mar 31 2020, 2:11 AM.

Details

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.

Diff Detail

Event Timeline

labath created this revision.Mar 31 2020, 2:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2020, 2:11 AM

This stems from D76835 -- when the inherit fallback on windows gets removed some tests fail bacause the can't find ls. This is used in lldbutil.wait_for_file_on_target. The inheritance was not a problem because ls is normally in the hardcoded default path, but that is not the case on windows.

friss accepted this revision.Mar 31 2020, 7:55 AM

I agree host shell command should run with the host environment.

This revision is now accepted and ready to land.Mar 31 2020, 7:55 AM
This revision was automatically updated to reflect the committed changes.