dotenv-cli update
Thanks to Nicholas Guriev,
dotenv-cli now uses exec
instead of popen
to create the new process on
POSIX
systems.
As a refresher, dotenv-cli is a package that
provides the dotenv
command. dotenv
reads the .env
file from the current
directory, puts the contents in the environment variables, and executes the
given command with the extra environment variables set.
dotenv
comes in handy if you follow the 12 factor app
methodology or just need to run a program locally with specific environment
variables set.
With this new change, when you call
dotenv my_awesome_tool
instead of forking a new process for my_awesome_tool
, effectively creating a
child process of dotenv
, dotenv
now uses exec
to “become” the new
process. This is a bit cleaner, as there is no longer a dotenv
-process
running that you don’t actually care about, and less-error prone when trying to
send signals such as SIGTERM
to the processes that runs my_awesome_tool
.
Unfortunately, exec
does not work properly under Windows, so here we still
fall back to using popen
.
This new feature is available in version 3.2.0 which is available on PyPI and debian/unstable.