C++ Logo


Advanced search

Re: [isocpp-lib-ext] std::environment

From: Zhihao Yuan <zy_at_[hidden]>
Date: Mon, 02 Jan 2023 05:41:47 +0000
On Jan 1, 2023, 8:31 PM, Jeff Garland via Lib-Ext < lib-ext_at_[hidden]> wrote:

> 1) It is a non-negotiable requirement for std::process — a different proposal I’ll be restarting — to write the environment before launching a child process —

Assuming there exists a Python subprocess-style library that supports passing in an environment object, we can replace this parameter with a callback that takes an environment object by lvalue reference. To adjust environment variables before launching a process, one has to pass in something like:

\[\](environment &env)
\{ env.insert\_or\_update("LC\_CTYPE", "C"); \}

By doing so, the environment would be both safe to mutate and has less chance to interact badly with third-party code.


Sent from Proton Mail mobile

Received on 2023-01-02 05:41:54