DaanDeMeyer / reproc

A cross-platform (C99/C++11) process library
MIT License
552 stars 65 forks source link

Replacing environment variables #62

Open takase1121 opened 3 years ago

takase1121 commented 3 years ago

I'm writing a reproc binding to lua, from what I tested REPROC_ENV_EXTEND does not allow me to replace existing envvars. Is this an explicit design decision or is it a bug?

An example of replacing existing envvars would be trying to append to PATH.

DaanDeMeyer commented 3 years ago

I didn't consider this when implementing REPROC_ENV_EXTEND. I'm not entirely sure what the behaviour is on all of the supported platforms when the environment block contains the same environment variable multiple times. Wouldn't the last occurrence override earlier occurrences? If so, would that suffice to replace environment variables? Let me know if this doesn't work as expected.