ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: AW: ANT called from .bat unknown Error
Date Fri, 27 Oct 2006 13:13:14 GMT
>>> > bat files are not executable, use cmd.exe instead and the bat as 
>>> > argument.
>>> > See FAQ and (1.7) manual.
>>>
>>> I've been thinking about this. Why dont we have Exec complain if we 
>>> find a .bat or .cmd at the end of an executable on windows?
>> 
>> Because one can execute some bat files directly:
>> hello.bat
>> -----------
>> echo "Hello"
>> ------------
>> build.xml
>> ------------
>> <project><exec executable="hello.bat"/></project>
>> ------------
>> Result:
>> Buildfile: build.xml
>>     [exec] C:\>echo "Hello"
>>     [exec] "Hello"
>> BUILD SUCCESSFUL
>> 
>> That is why I said "cannot in general by executed directly"
>> (typo included!)
>> I do not know the (as usual in windows land) crazy rules on 
>using .bat 
>> files directly.
>
>It probably depends on how ant chooses to run the program, and 
>how the JVM works underneath.


Maybe a hint on the fail message?

try {
    executeTheCommand(...);
} catch ( ?? ) {
    if (executable.endsWith(".bat") || .endsWith(".sh")) {
        getProject("Dont execute shell scripts directly use command
interpreter...", MSG_DEBUG);
    }
    throw new BuildException(...);
} 


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message