-
-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENV SubTask Not Working as Expected #1395
Comments
My original description and identification of the issue was clumsy, at best. There are more cogent descriptions of the issue here: https://stackoverflow.com/questions/30180187/setting-an-environment-variable-on-same-line-as-program-execution-is-different-t# Adding an PR incoming. |
👍 |
@jimdelois thanks for the contribution - we have to think about such a feature carefully as it could have some side effects Try the following snipped: <exec executable="sh" outputProperty="outputProperty">
<arg value="-c"/>
<arg value="export HELLO=hello; export WORLD=world; php -r "var_dump(\$_ENV);""/>
</exec>
<echo msg="${outputProperty}"/> |
@mrook I set this to |
@siad007 - Thanks for the update and temporary recommendation. For what it's worth, during the meanwhile I have been using my own Task to remove the semicolon, defined as:
This has allowed me to successfully pass in a shell variable to my Behat script as per Phing's debug output:
... using a target defined as:
I am good for the time being - please let me know if I can contribute further. |
What is the status of this? It seems it was accepted and then reverted, which is a poor way of making a bug appear resolved. Any updates? |
Thanks for your interest Jim. This was fixed in #1419, but we did not tag that PR to this issue. |
Thanks, @mrook . However, that PR doesn't address this bug or take in any changes from the PR I submitted. As I noted above, the issue is in using the semi colons without the When I add the test case I've already provided to the master branch, it fails on Mac. I will continue to use my workaround, noted above. |
We'll take another look at it. |
@jimdelois the two commits above should fix this for both platforms (unix/windows). If they don't, we'll re-open this issue. |
For the
env
sub-task of theexec
task, this line has the effect of creating multiple, distinct commands - not the intended effect of adding an environment variable to a command. This works for simple commands likeecho
(as per the test), but does not work as expected for scripts that delegate execution to other commands. For example, this does not work when executing./vendor/bin/behat
, which ultimately calls through tophp
where the environment variables are then lost.It does not work on Linux or Mac operating systems. Would there be a downside to removing the the semicolon?
The text was updated successfully, but these errors were encountered: