[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: pre-commit.cmd

From: Jaap Vermeulen <jaap_at_skyscape.com>
Date: 2004-10-06 16:09:58 CEST

I found what the problem is. I treat this script as a batch file, and in
batch file programming you normally use various constructs to return an
error code. E.g.

verify generate_error 2>NUL
goto :EOF

would be one construct. Another one would be:

exit /b 12

Both will exit the script, but not the cmd interpreter, with a non-zero exit
code. Using "exit" directly (without the /b) will exit the invoking command
interpreter, i.e. your command window will disappear if you run it from a
command window. On UNIX, of course, this isn't a problem since you can't
exit the invoking command interpreter. On Windows... sigh... :-)

At any rate, it looks like this error code is not picked up and returned by
the command interpreter that svnserve invokes. As a matter of fact, this
can be easily seen when you save the "@exit /b 12" above as a script, e.g.
t.cmd, and running it from the cmd prompt:

> t.cmd
> echo %ERRORLEVEL%
12

> cmd /c t.cmd
> echo %ERRORLEVEL%
0

Whether this is to be expected or not, I'll leave to the experts. Avoiding
this problem in the command interpreter involves changing the invocation to
something like:

cmd /c "call t.cmd || exit 1"

Thanks for listening,

        -Jaap-

> -----Original Message-----
> From: kfogel@newton.ch.collab.net [mailto:kfogel@newton.ch.collab.net]On
> Behalf Of kfogel@collab.net
> Sent: Tuesday, October 05, 2004 8:43 PM
> To: Jaap Vermeulen
> Cc: users@subversion.tigris.org
> Subject: Re: pre-commit.cmd
>
>
> "Jaap Vermeulen" <jaap@skyscape.com> writes:
> > I am using 1.1.0 on a Windows box with svnserve. I wrote a little
> > pre-commit.cmd that returns a non-zero exit status, but my
> commits happily
> > succeed. I'm writing to a log to make sure the script is executed etc.
> > What am I overlooking, or is this simply not working?
>
> That's very odd/bad. Can you show us the content of your hook, of
> pre-commit.cmd, and of the recipe you use to test this?
>
> Thanks,
> -Karl
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Oct 6 16:10:23 2004

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.