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

RE: Re: Post-Commit help

From: Brian Erickson <erickson_at_BAUERCONTROLS.com>
Date: Wed, 6 Aug 2008 08:03:39 -0400

I belived Command.com is required. I could not get Cmd.exe to work.
Remember the goal here is to start a process in the background and let
the commit succeed before the process finishes.

It's my understanding that Subversion waits for stdout and stderr to be
closed. If you use cmd.exe or just start (which invokes cmd.exe on your
behalf) the started process inherits stdout and stderr from the caller
and there does not seem to be a way to change that behavior (at least I
haven't found one). So, the subversion client will wait until the
backgroud process completes and therefore closes stdout and stderr.

Here are the comand line options for command.com

COMMAND [[drive:]path] [device] [/E:nnnnn] [/P] [/C string] [/MSG]

  [drive:]path Specifies the directory containing COMMAND.COM file.
  device Specifies the device to use for command input and
output.
  /E:nnnnn Sets the initial environment size to nnnnn bytes.
  /P Makes the new command interpreter permanent (can't
exit).
  /C string Carries out the command specified by string, and then
stops.
  /MSG Specifies that all error messages be stored in memory.
You
                  need to specify /P with this switch.

The first parameter I specified (nul) is the device to use for input and
output. So, the new background process has no stdout or stderr. So,
the Subversion client is free to finish well before the new background
process.

As far as the ping command goes, it's a common trick to implement a
delay. The 127.0.0.1 address always replies so you can't use it to
implement a delay. The 1.1.1.1 address is almost never valid so it
almost always works when implmementing a delay.

If you try the example, you'll see that commits will finish before the
background process (the ping) finishes. That's the whole point of the
exercise.

Brian

> -----Original Message-----
> From: Konstantin Kolinko [mailto:knst.kolinko_at_gmail.com]
> Sent: Tuesday, August 05, 2008 10:02 PM
> To: George Stein; James O'Reilly
> Cc: users_at_subversion.tigris.org
> Subject: Re: Post-Commit help
>
> 2008/8/5 George Stein <george.stein_at_go4more.de>:
> >
> >> Brian Erickson wrote:
> >>
> >> My pre commit hook (pre-commit.bat)
> >> start command nul /c d:\temp\test\hooks\newp.bat
> >>
> >> Contents of newp.bat
> >> ping -n 1 -w 30000 1.1.1.1 (this is essentially a 30
> second delay)
> >>
> >> NOTE:
> >> 1) It's important that you run command (not cmd).
> >> 2) Command is limited to the old 8.3 DOS notation for
> files. If
> >> you try to execute a batch file or program that has a long
> file name
> >> you'll get a 'bad command for file name' error.
> >> 3) Command is still around with Vista but I didn't test there
> >>
>
> I do not understand this suggestion regarding command.com.
> The cmd.exe should work just fine.
>
> start cmd.exe /c d:\temp\test\hooks\newp.bat
>
> And even simplier
>
> start /c d:\temp\test\hooks\newp.bat
>
> What is the purpose of nul argument (aka windows version of
> /dev/null) in your example of calling the bat file? Are you
> redirecting some input or output to/from there?
>
> I also do not like pinging someone's 1.1.1.1 Use your own
> 127.0.0.1 for that purpose.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: users-help_at_subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-08-06 14:04:19 CEST

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.