Closed yentlprojects closed 1 year ago
This looks like a valid bug, although an easy workaround would be simply to pass two different environment variables, one for Ddb.username
and Ddb.password
, so this doesn't seem like a really high priority to fix.
In understand this might not be high priority to fix, but in our use case it isn't really possible to just pass 2 environment variables, because this heavily limits the reusability of the script, as this "extra_arg_string" command gets passed through to a maven build inside a docker container. The goal is for the jake script to accept any amount of env vars/system properties and pipe those through to the docker build. (but only those that are meant for the docker build, not potentially other env vars that might be used elsewhere in the jake script)
Another possibility would be simply to set env variables before invocation, like so:
EXTRA_ARG_STRING="-Ddb.username=my-db-user -Ddb.password=my-password" jake test`
Another way to set an env variable for your tasks would be to require
a file in your jakefile that sets them for you:
process.env.EXTRA_ARG_STRING = 'Ddb.username=my-db-user -Ddb.password=my-password';
That "equals" syntax was originally implemented simply to copy all of Rake's API. There's no specific reason to set environment variables that way.
Hope that helps.
I would add, that "equals" syntax actually sets full-blown environment variables. If you're just wanting to pass args through the Jake task, you'd be better served by just passing args:
https://jakejs.com/docs-page.html#item-advanced-usage-passing-parameters
When passing arguments to Jake using the environment variables syntax, it breaks when a value contains an equal sign:
Say we have the following task:
Which we invoke as follows:
The process.env variable stops right before the first equals sign in the value:
Escaping equals sign with backslashes also does not seem to work.