It's not possible to pass customized environment variables to child process
Closed / Rejectedd2b144e4612c10f870ee496c1d38a0634f4e7906Created 12 years agoUpdated 11 years ago
Descriptionplain2015-06-05 23:21:40
Hi, there is no easy way to pass customized environment variables to a child process. When tcl use "exec" or "open" with pipes, all the environment variables are inherited to the child process. But it's not possible to set in advance environment variables different from the parent process and exclusive for that child process. For example there is no -env option in the "exec" command to pass a list of customized environment variables for the child process. It seems that the only way is to set temporarily environment variables in ::env, spawn a new child process, and then restore that changed environment variables to their original value.
ferrieuxplain2015-06-06 14:01:12
The only circumstance where that could matter, is multiple threads spawning children in an uncoordinated way; this is easily solvable by proper synchronization (e.g by dedicating a thread to the job and thread::send'ing it spawn orders). So, doing what you suggest would significantly clutter the API for a very very tiny corner case with an efficient current solution.
jan.nijtmans Closed ticket [d2b144e461].
[History diff]2015-10-09 12:47:02
Log in (anonymous is fine) to add a comment.