You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@continuum.apache.org by Baz <br...@gmail.com> on 2005/11/04 16:52:30 UTC

solution for exit code problems in maven1

I've added this as a comment on
http://jira.codehaus.org/browse/CONTINUUM-413 but since several people
are having the problem, I thought I'd tell the list.

The correct answer is, change continuum's run.bat to begin:
@echo off
set MAVEN_TERMINATE_CMD=on

then add this one line to the end of maven.bat:
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERRORLEVEL%

I've tested this solution, it works under winXP, maven 1.0.2.

Hope this helps,
Baz

Re: solution for exit code problems in maven1

Posted by Baz <br...@gmail.com>.
The environment of the parent process is carried through to child
processes: you define it in run.bat so it's in java.exe's environment,
and hence in the environment of processes java spawns, and so on.

That's actually semi-sensible. Its the behaviour of 'exit' in batch
files that's just freaky. In *nix systems, executing a shell script
happens in a separate process. Not so in windows, executing a batch
file from the command line is more akin to a function call. Hence the
difference between 'exit' (exits the process, ie cmd.exe, with a real
return code) and 'exit /B' (pop back up to the calling batch, setting
ERRORLEVEL, don't set the error code).

It's just nuts. In the absence of a sensible 'exit', we need something
like 'isatty()' to tell us which way to call it, but AFAIK you can't
get this info.

Isn't windows great?

Cheers,
Baz

On 11/4/05, Emmanuel Venisse <em...@venisse.net> wrote:
> I'm surprised that it works if you define MAVEN_TERMINATE_CMD in run.bat
>
> Emmanuel
>
> Baz a écrit :
> > I've added this as a comment on
> > http://jira.codehaus.org/browse/CONTINUUM-413 but since several people
> > are having the problem, I thought I'd tell the list.
> >
> > The correct answer is, change continuum's run.bat to begin:
> > @echo off
> > set MAVEN_TERMINATE_CMD=on
> >
> > then add this one line to the end of maven.bat:
> > if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERRORLEVEL%
> >
> > I've tested this solution, it works under winXP, maven 1.0.2.
> >
> > Hope this helps,
> > Baz
> >
> >
> >
>
>

Re: solution for exit code problems in maven1

Posted by Emmanuel Venisse <em...@venisse.net>.
I'm surprised that it works if you define MAVEN_TERMINATE_CMD in run.bat

Emmanuel

Baz a écrit :
> I've added this as a comment on
> http://jira.codehaus.org/browse/CONTINUUM-413 but since several people
> are having the problem, I thought I'd tell the list.
> 
> The correct answer is, change continuum's run.bat to begin:
> @echo off
> set MAVEN_TERMINATE_CMD=on
> 
> then add this one line to the end of maven.bat:
> if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERRORLEVEL%
> 
> I've tested this solution, it works under winXP, maven 1.0.2.
> 
> Hope this helps,
> Baz
> 
> 
>