aristanetworks / bst

A one-stop shop for process isolation
MIT License
99 stars 9 forks source link

cli,env: add ability to override environment of the spacetime process #36

Closed Snaipe closed 3 years ago

Snaipe commented 3 years ago

We hoped that FOO=bar bst true would have been enough to run true with FOO=bar in its environment, but this is in fact lacking in two aspects.

First, this is only possible from a shell -- programs that execve bst had to just pass the desired environment, but this ends up being less clear when inspecting running bst processes since it is not part of the process command line.

Second, for a few select environment variables, overriding their value from the outside results in some behavioral change and general annoyance: For instance, PATH=/bin bst true typically does not work if bst isn't installed in /bin.

This commit addresses this by allowing users to pass VAR=value before the executable name to override specific environment variables, in the same manner as /usr/bin/env. A --no-env switch is also there if clearing the environment of the spacetime process is desirable.