The problem here was that the env file can start out with an empty
string "", and the previous logic was adding a newline to that value
before adding the new environment variable, resulting in a file that
looks like this:
# <-- empty line
NX_CACHE_STEP_WAS_SUCCESSFUL_HIT=true
This would not be properly parsed by the runner.
Changing the implementation to appendFileSync, as well as putting the newline after the new variable fixes the issue
The problem here was that the env file can start out with an empty string
""
, and the previous logic was adding a newline to that value before adding the new environment variable, resulting in a file that looks like this:This would not be properly parsed by the runner.
Changing the implementation to
appendFileSync
, as well as putting the newline after the new variable fixes the issue