[Anthill-pro] Re: Shell and failing script doubt

emerson cargnin echofloripa.yell at gmail.com
Mon Apr 7 06:21:44 CDT 2008


Hi

I solved it changing my postprocessing script to:

return Fail.on(
               ExitCode.is(0)
              )

As egrep will return an error code 1 if doesn't find anything, and I
want to make it fail in the case it finds (resources not properly
merged), checking for the exit code is the easiest way to make this to
work.

thanks
emerson

On 07/04/2008, emerson cargnin <echofloripa.yell at gmail.com> wrote:
> Hi All
>
> I have a job library to pre-process our resources depending on the
> environment. I then run a shell script to check if there is any
> property not merged. I use the following shell script:
>
> egrep @[a-zA-Z0-9__]+@ ./target/resources/*.*
>
> This shouldn't return anything if all properties are merged (no @XXX@
> left in the files). I then execute the following beanshell failing
> script:
>
> return Fail.unless(
>   Logic.and(
>    Logic.not(Output.contains("target/resources/")),
>     ExitCode.is(0)
>    )
>   )
>
> because there is no pattern string to verify for failing, then I check
> if the root folder appears on the log and fail based on this.
>
> Now... It happens that it is failing even if when I run it manually it
> doens't returns anything. I'm suspecting that the command is present
> on the log as well, which then makes the script fail as if it was the
> result of the command.
>
> How could I change it so that it will fail only when I get any results
> from my script?
>
> Thanks
> Emerson
>


More information about the Anthill-pro mailing list