diff --git a/pmg-rs/src/lib.rs b/pmg-rs/src/lib.rs index 6b7ee4c..4a91632 100644 --- a/pmg-rs/src/lib.rs +++ b/pmg-rs/src/lib.rs @@ -14,4 +14,12 @@ mod export { pub fn init() { common::logger::init("PMG_LOG", "info"); } + + /// CLI tools should call this very early. This is a workaround causing environment variable + /// manipulation to leak instead of crash. Required when calling into rust code that causes + /// `setenv` calls, particularly code using the openssl crate. + #[export] + pub fn use_safe_putenv() { + perlmod::ffi::use_safe_putenv(true); + } }