[cvsnt] Module information

Thomas Jensen cbm_silverflame at yahoo.com
Wed Oct 3 15:13:38 BST 2007


Hello Gerhard,

I tried the advice that you and Arthur gave me about
calling the bat file by using cmd.exe.

But it didn't change anything. I decided to verify
that the return codes from the bat files were still
passed correctly by doing the following experiment:

I have a file called precmdtest.bat:

@echo off
echo -------------------------
echo User: %1
echo Location: %2
echo Command: %3
echo Timestamp: %4
echo -------------------------
echo Arguments: %5
echo -------------------------

rem below for testing purpose only... 
rem testing exit status return codes!!!

if %3 == update goto deny

goto allow

:deny
echo Command %3 issued by %1 at %4
echo was NOT allowed on repo %2
EXIT 1

:allow
echo Command %3 issued by %1 at %4 
echo was allowed on repo %2
EXIT 0

This bat file is called in my precommand file in the
following way:

ALL C:/precmdtest.bat $USER %r %c %d

I added the section below the remark lines and it
worked correctly and stopped the update command from
working.

This is the output on the commandline:

C:\TEST_CHECKOUT\blabla>cvs update
-------------------------
User: cvsadmin
Location: /TESTREPO
Command: update
Timestamp: "Wed Oct  3 14:06:47 2007"
-------------------------
Arguments:
-------------------------
Command update issued by cvsadmin at "Wed Oct  3
14:06:47 2007"
was NOT allowed on repo /TESTREPO
cvs server: Pre-command check failed

C:\TEST_CHECKOUT\blabla>

And in this case the EXIT 1 returncode was interpreted
correctly by CVSNT.

It seems to be because the premodule file, does not
have the capability to stop a cvs command from being
executed.

I have also tried called a bat file in precommand in
the following way:

/TESTREPO/blabla C:/info.bat $USER %r %c %d

because I hoped that the string /TESTREPO/blabla would
be recognized as the blabla module. 

CVSNT didn't report any errors, but on the other hand,
it also never called the info.bat file.

Regards from Thomas (aka CBMFreak).

--- Gerhard Fiedler <lists at connectionbrazil.com>
wrote:
> 
> As Arthur said, CVSNT may not see the .bat file's
> return code but the
> cmd.exe return code -- which not necessarily is the
> same. 
> 
> I don't know cmd.exe intimately because I don't use
> it, but you can
> experiment a bit with it to determine how its return
> code handling works.
> Make sure you call your batch files with "cmd.exe /c
> <batch file>" and then
> check the return code of that command (which is
> different from running a
> batch file in the same session and checking its
> return code).
> 
> If the return code passing should be a problem, you
> could also try running
> your scripts as .cmd files instead of .bat files, or
> set the ERRORLEVEL
> variable explicitly before exiting, or use a batch
> file compiler to create
> an .exe from your script (which you can call
> directly, without going
> through cmd.exe), or use a different script --
> Windows Script Host (VBS,
> JavaScript mainly), Python, bash, 4NT, whatever.
> 
> Gerhard
> _______________________________________________
> cvsnt mailing list
> cvsnt at cvsnt.org
> http://www.cvsnt.org/cgi-bin/mailman/listinfo/cvsnt
> 



      ___________________________________________________________ 
Skal du købe ny bil? Sammenlign priser på brugte biler med Kelkoo og find et godt tilbud! - Se mere her http://dk.yahoo.com/r/pat/mmb


More information about the cvsnt mailing list