Skip to content

Commit

Permalink
Ensure line ending after copied env
Browse files Browse the repository at this point in the history
If a user creates an env file without a trailing newline, the mdc
comments can interfere with the resulting value/environment:

```
$ echo -n "MY_VALUE=123" > modes/somemode/env
$ ./mdc somemode
$ cat .env
MY_VALUE=123### mdc end mode somemode
```
  • Loading branch information
jonsmock committed Jun 6, 2024
1 parent db86dad commit d6f7551
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mdc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ for resolved in ${RESOLVED_MODES}; do
echo "### mdc begin mode ${mode} (${efile})" >> ${ENV_FILE}-mdc-tmp
vecho "cat ${efile} >> ${ENV_FILE}-mdc-tmp"
cat ${efile} >> ${ENV_FILE}-mdc-tmp
echo >> ${ENV_FILE}-mdc-tmp
echo "### mdc end mode ${mode} (${efile})" >> ${ENV_FILE}-mdc-tmp
fi
done
Expand Down

0 comments on commit d6f7551

Please sign in to comment.