Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#741 variable with if statement not working inside setenv

0.90
open
Ryan Boggs
Functions (16)
5
2010-07-04
2010-06-30
Anonymous
No

I have the following setenv block:

<setenv verbose="true" failonerror="false">
<variable name="test" value="${environment::get-variable('some_non_existing_envvar')}" if="${environment::variable-exists('some_non_existing_envvar')}" />
</setenv>

The environment variable does not exist, but I get a fatal error as the value is still attempted to be set.

Function call failed.
Expression: ${environment::get-variable('some_non_existing_envvar')}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Environment variable "some_non_existing_envvar" does not exist.

If I move the "if" statement up to the setenv level, the variable is not set which is what I expect.
The workaround I am using is this:

<if test="${environment::variable-exists('some_non_existing_envvar')}" >
<setenv verbose="true" name="test" value="${environment::get-variable('some_non_existing_envvar')}">
</if>

Discussion

  • Ryan Boggs
    Ryan Boggs
    2010-07-04

    • assigned_to: nobody --> rmboggs
     
  • Ryan Boggs
    Ryan Boggs
    2010-07-04

    I'll take a look but I can't promise anything. I'll keep you posted.