You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Steve Middleton <st...@codebaby.com> on 2007/10/02 22:14:11 UTC

Exec is failing, command line works fine

Hi everyone,

I'm having a problem with an executable that seems to work fine from the
command line, but does not work with the ant "exec" task.  

If I type this into the command line, it works no problem:
 
emake -B -f mymakefile.mak


But if I use the following build.xml file with Ant:

<project default="BuildEureka">

    <target name="BuildEureka" depends="">
    	<exec executable="emake" failonerror="true">
    	   <arg line="-B -f psbase.mak"/>
    	</exec>
    </target>

</project>


...I end up with the following output:

Buildfile: build.xml

BuildEureka:
	[exec] MAKE Version 5.2  Copyright (c) 1987, 2000 Borland

	[exec] ** error 1 ** deleting Debug_Build

BUILD FAILED
...

I have also tried to use the "value" type arg elements, but the result is
the same.  For those of you that are interested, the executable I'm trying
to run is EurekaLog's "emake.exe", intended to be used in place of Borland
"make.exe"  Not sure if it has anything to do with this issue, but when I
try to redirect the output of emake.exe to a file, it says "The handle is
invalid."

Does anyone know what's going on here?

Any help would be greatly appreciated -- thanks!

- Steve


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


Re: Exec is failing, command line works fine

Posted by Robert Clark <ro...@quest.com>.
On Tuesday October 2, 2007, "Steve Middleton" 
<st...@codebaby.com> wrote:

> As for the environment variables, the documentation for "emake" is
> lacking, but it doesn't mention anything about environment
> variables, so I'm not entirely sure.  I've contacted support for
> EurekaLog, but they simply told me they haven't heard of this issue
> as of yet.
>
> Is there anything else this could be?

I'm afraid I'm running low on ideas. The original error message:

  "** error 1 ** deleting Debug_Build"

is obviously from emake, but I've never used it so I have no idea what 
it actually means. All we know for sure is that Ant was able to run 
the program.

> Not sure if it has anything to do with this issue, but when I
> try to redirect the output of emake.exe to a file, it says "The
> handle is invalid."

When you redirected the output, did you use the "output" attribute of 
the <exec/> task?

You might also want to try the "vmlauncher" attribute of <exec/>, but 
setting it to "true". The docs for the <exec/> contain more detains 
on why this might work.

Perhaps posting a snippet of the debug output that shows the native 
command being executed and the setup of the native command will 
prompt an brainstorm from someone else on the list.

- Rob




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


RE: Exec is failing, command line works fine

Posted by Steve Middleton <st...@codebaby.com>.
  - what directory is Ant executing the command in? Is it the 
    same as from the command line?

I've already checked this one.

  - How is Ant passing the command line args? Is it the same as the
    shell would?

I've tried both methods i.e. like the following:
  <arg value="-B"/>
  <arg value="-f"/>
  <arg value="psbase.mak"/>
Either way, I get the same result.

  - Are there any environment variable that are missing when run
    through Ant? There should not be, but you never know.

As for the environment variables, the documentation for "emake" is lacking,
but it doesn't mention anything about environment variables, so I'm not
entirely sure.  I've contacted support for EurekaLog, but they simply told
me they haven't heard of this issue as of yet.

Is there anything else this could be?


-----Original Message-----
From: Robert Clark [mailto:robert.clark@quest.com] 
Sent: October 2, 2007 2:25 PM
To: Steve Middleton
Cc: user@ant.apache.org
Subject: Re: Exec is failing, command line works fine

On Tuesday October 2, 2007, "Steve Middleton" 
<st...@codebaby.com> wrote:
> I'm having a problem with an executable that seems to work fine
> from the command line, but does not work with the ant "exec" task.

When I run into this, I generally look at 3 things:

  - what directory is Ant executing the command in? Is it the 
    same as from the command line?
  - How is Ant passing the command line args? Is it the same as the
    shell would?
  - Are there any environment variable that are missing when run
    through Ant? There should not be, but you never know.

The first two can be determined by running your Ant build script with 
the -d (for debug) command line option. That will tell you exactly 
what command Ant is executing under the hood.

As a side note, I generally prefer to break up args into individual 
elements so there is no change of them being mis-parsed. So:

  <arg line="-B -f psbase.mak"/>

would be

  <arg value="-B"/>
  <arg value="-f"/>
  <arg value="psbase.mak"/>

but that's just a personal paranoia.

- Rob



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



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


Re: Exec is failing, command line works fine

Posted by Robert Clark <ro...@quest.com>.
On Tuesday October 2, 2007, "Steve Middleton" 
<st...@codebaby.com> wrote:
> I'm having a problem with an executable that seems to work fine
> from the command line, but does not work with the ant "exec" task.

When I run into this, I generally look at 3 things:

  - what directory is Ant executing the command in? Is it the 
    same as from the command line?
  - How is Ant passing the command line args? Is it the same as the
    shell would?
  - Are there any environment variable that are missing when run
    through Ant? There should not be, but you never know.

The first two can be determined by running your Ant build script with 
the -d (for debug) command line option. That will tell you exactly 
what command Ant is executing under the hood.

As a side note, I generally prefer to break up args into individual 
elements so there is no change of them being mis-parsed. So:

  <arg line="-B -f psbase.mak"/>

would be

  <arg value="-B"/>
  <arg value="-f"/>
  <arg value="psbase.mak"/>

but that's just a personal paranoia.

- Rob



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


RE: Exec is failing, command line works fine

Posted by Steve Middleton <st...@codebaby.com>.
Sorry, in regards to my last post, please replace "psbase.mak" with
"mymakefile.mak"

-----Original Message-----
From: Steve Middleton [mailto:stephen.middleton@codebaby.com] 
Sent: October 2, 2007 2:14 PM
To: 'Ant Users List'
Subject: Exec is failing, command line works fine

Hi everyone,

I'm having a problem with an executable that seems to work fine from the
command line, but does not work with the ant "exec" task.  

If I type this into the command line, it works no problem:
 
emake -B -f mymakefile.mak


But if I use the following build.xml file with Ant:

<project default="BuildEureka">

    <target name="BuildEureka" depends="">
    	<exec executable="emake" failonerror="true">
    	   <arg line="-B -f psbase.mak"/>
    	</exec>
    </target>

</project>


...I end up with the following output:

Buildfile: build.xml

BuildEureka:
	[exec] MAKE Version 5.2  Copyright (c) 1987, 2000 Borland

	[exec] ** error 1 ** deleting Debug_Build

BUILD FAILED
...

I have also tried to use the "value" type arg elements, but the result is
the same.  For those of you that are interested, the executable I'm trying
to run is EurekaLog's "emake.exe", intended to be used in place of Borland
"make.exe"  Not sure if it has anything to do with this issue, but when I
try to redirect the output of emake.exe to a file, it says "The handle is
invalid."

Does anyone know what's going on here?

Any help would be greatly appreciated -- thanks!

- Steve


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



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