Page MenuHomePhabricator

[lit] add support for unsetting environment variable

Authored by jlpeyton on Jul 8 2016, 10:44 AM.



This patch adds support for the -u flag for the env command. The -u flag allows users to explicitly unset an environment variable for a particular command. This is useful for OpenMP which heavily relies on environment variables to determine the library's behavior in certain situations. So being able to unset a potentially polluted environment is important.

Example usage:
env -u FOO -u BAR GOO=16 CAR=5
This removes both FOO and BAR from the environment while setting GOO=16 and HAR=5.

Diff Detail


Event Timeline

jlpeyton updated this revision to Diff 63256.Jul 8 2016, 10:44 AM
jlpeyton retitled this revision from to [lit] add support for unsetting environment variable.
jlpeyton updated this object.
jlpeyton added a reviewer: ddunbar.
jlpeyton set the repository for this revision to rL LLVM.
jlpeyton added a subscriber: llvm-commits.
ddunbar edited edge metadata.Sep 1 2016, 8:24 PM

This looks reasonable to me, can we get a test for the behavior though?

jlpeyton updated this revision to Diff 70449.Sep 6 2016, 12:37 PM
jlpeyton edited edge metadata.

Added testing for env and env -u feature of ShTest format

ddunbar accepted this revision.Oct 5 2016, 3:22 PM
ddunbar edited edge metadata.


This revision is now accepted and ready to land.Oct 5 2016, 3:22 PM
jlpeyton abandoned this revision.Sep 26 2017, 4:20 PM

D36403 committed this functionality (a74a4df4d5 or svn r311180) . This revision is not needed.