ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mehmet Celik <mehmet.ce...@ubizen.com>
Subject ANT is not capturing the return values of the executed programs.
Date Wed, 16 Apr 2003 13:09:04 GMT
PROBLEM:see subject.
OUTPUT:please, scroll down.
ENVIRONMENT: RedHat 8.0, j2sdk1.4.1_02, ant-1.5.3


I'm just testing what can and can not be done with ANT. The idea in this 
test is just to see if return values of an external script in this case 
a simple SHELL script and an executable written in C get picked up by ANT.

Browsing the execTask code everything looks ok, did anybody else 
encounter the same strange behaviour?


FILE: build.xml

<project name="testExecReturn" basedir="." default="init1">
  <target name="init1" >
      <exec failonerror="false" executable="bash" 
resultproperty="test.returnBash">
           <arg value="-c" />
           <arg value="${basedir}/test_bash.sh" />
      </exec>
      <exec failonerror="false" executable="${basedir}/test_bash.sh" 
resultproperty="test.returnBash2" />   
      <exec failonerror="false" executable="${basedir}/test_c" 
resultproperty="test.returnC"/>

      <echo message="${test.returnBash}"/>
      <echo message="${test.returnBash2}"/>
      <echo message="${test.returnC}"/>
  </target>
</project>



FILE: test_bash.sh

#!/bin/bash
echo Bash returns
exit -1


FILE:test_c.c
compile first:   cc -o test_c  test_c.c

#include <stdio.h>

int main(void)
{
        printf("C returns \n");
        return -1;
}



And now the interesting stuff the output.

Buildfile: build.xml

init1:
     [exec] Bash returns
     [exec] Bash returns
     [exec] C returns
     [echo] 0
     [echo] 0
     [echo] 0

BUILD SUCCESSFUL
Total time: 1 second

(85) $ ant
Buildfile: build.xml

init1:
     [exec] Bash returns
     [exec] Result: -1
     [exec] Bash returns
     [exec] C returns
     [echo] -1
     [echo] 0
     [echo] 0

BUILD SUCCESSFUL
Total time: 1 second

(86) $ ant
Buildfile: build.xml

init1:
     [exec] Bash returns
     [exec] Result: -1
     [exec] Bash returns
     [exec] C returns
     [echo] -1
     [echo] 0
     [echo] 0

BUILD SUCCESSFUL
Total time: 1 second

(87) $ ant
Buildfile: build.xml

init1:
     [exec] Bash returns
     [exec] Result: -1
     [exec] Bash returns
     [exec] C returns
     [echo] -1
     [echo] 0
     [echo] 0

BUILD SUCCESSFUL
Total time: 1 second

(88) $ ant
Buildfile: build.xml

init1:
     [exec] Bash returns
     [exec] Bash returns
     [exec] Result: -1
     [exec] C returns
     [echo] 0
     [echo] -1
     [echo] 0

BUILD SUCCESSFUL
Total time: 1 second

(89) $ ant
Buildfile: build.xml

init1:
     [exec] Bash returns
     [exec] Bash returns
     [exec] C returns
     [echo] 0
     [echo] 0
     [echo] 0

BUILD SUCCESSFUL
Total time: 1 second

(90) $ ant
Buildfile: build.xml

init1:
     [exec] Bash returns
     [exec] Bash returns
     [exec] C returns
     [echo] 0
     [echo] 0
     [echo] 0

BUILD SUCCESSFUL
Total time: 1 second

(91) $ ant
Buildfile: build.xml

init1:
     [exec] Bash returns
     [exec] Result: -1
     [exec] Bash returns
     [exec] Result: -1
     [exec] C returns
     [echo] -1
     [echo] -1
     [echo] 0

BUILD SUCCESSFUL
Total time: 1 second

(92) $ ant
Buildfile: build.xml

init1:
     [exec] Bash returns
     [exec] Bash returns
     [exec] C returns
     [echo] 0
     [echo] 0
     [echo] 0

BUILD SUCCESSFUL
Total time: 1 second

(93) $ ant
Buildfile: build.xml

init1:
     [exec] Bash returns
     [exec] Bash returns
     [exec] C returns
     [echo] 0
     [echo] 0
     [echo] 0

BUILD SUCCESSFUL
Total time: 1 second

(94) $ ant
Buildfile: build.xml

init1:
     [exec] Bash returns
     [exec] Bash returns
     [exec] C returns
     [echo] 0
     [echo] 0
     [echo] 0

BUILD SUCCESSFUL
Total time: 1 second




Mime
View raw message