Environment Variables
Friday, September 19, 2025
Factor has an environment vocabulary for working with process environment variables on all the platforms we currently support: macOS, Windows, and Linux.
Recently, I noticed that .NET 9 added support for empty environment variables. This was particulary relevant due to a test failure of the new Dotenv implementation on Windows. It turns out that we inherited the same issue that earlier .NET versions had, which is an inability to disambiguate an unset environment variable from one that was set to the empty string. This issue has now been fixed in the latest development version.
Before:
IN: scratchpad "FACTOR" os-env .
f
IN: scratchpad "" "FACTOR" set-os-env
IN: scratchpad "FACTOR" os-env .
f
After:
IN: scratchpad "FACTOR" os-env .
f
IN: scratchpad "" "FACTOR" set-os-env
IN: scratchpad "FACTOR" os-env .
""
IN: scratchpad "FACTOR" unset-os-env
IN: scratchpad "FACTOR" os-env .
f
There might be other cross-platform environment-related topics to investigate, such as an open issue to look into case-preserving but case-insensitive environment variables on Windows.
PRs welcome!