How to reset ENV

Patrick Böker <[email protected]> Thu, 24 Feb 2022 08:59:24 +0000
Newsgroups gmane.comp.lang.perl.par
Message-ID <[email protected]>
Hello everyone,

I'm using PAR to package Rakubrew (a Raku installation and versioning tool)=
 =20
on Windows and MacOS. I'm grateful for how easy and reliable PAR is. Thanks!

Rakubrew can act as a shim wrapper that forwards its call to other programs=
=2E=20
PAR modifies several environment variables amongst others DYLD_LIBRARY_PATH=
=2E I=20
suspect that the change to DYLD_LIBRARY_PATH can have unwanted side effects=
 for=20
the called program with respect to dynamically loading C libraries.

Thus I'd like to make Rakubrew reset the environment to its original state=
=20
before doing the final "exec". I'm grateful for any clues on how to best=20
approach this.

Is there any place, where the original untouched environment is persisted?
Are the variables PAR adds and the ones it modifies (and how) available=20
programmatically?
Is there any chance I can hook into PAR to save the environment before PAR=
=20
starts changing things?

My last resort would be to hard code variable names to remove and revert th=
e=20
changes to variables it modified with some regex-foo or similar. But I'd mu=
ch=20
prefer a different solution.

Thanks in advance for any hints!

Kind regards,
Patrick B=F6ker