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

Re: update hook per project (or directory)

From: Ryan Schmidt <subversion-2007a_at_ryandesign.com>
Date: 2007-03-17 23:28:48 CET

On Mar 17, 2007, at 07:25, Jan Hendrik wrote:

>> Anything you do just in the post-commit hook, or any script the post-
>> commit hook calls, or any script called by such a script, and so
>> forth, is fine.
>>
>> However, if you fork off a new process (create a thread, whatever),
>> then that is a separate process and the post-commit hook itself can
>> end before the forked process does, and that's when problems as
>> described above can start.
>>
>> So, by (Unix) example (since I don't know Windows):
>>
>> If my post-commit hook is...
>>
>>
>> #!/bin/sh
>> REPOS="$1"
>> REV="$2"
>> /path/to/some-other-script.sh "$REPOS" "$REV"
>>
>>
>> ....then everything is fine, because post-commit will wait for some-
>> other-script.sh to finish before it finishes.
>>
>> However, if my post-commit hook is...
>>
>>
>> #!/bin/sh
>> REPOS="$1"
>> REV="$2"
>> /path/to/some-other-script.sh "$REPOS" "$REV" >/dev/null 2>/dev/
>> null &
>>
>>
>> ....then some-other-script.sh has been forked off into its own
>> process, and post-commit ends immediately, before some-other-
>> script.sh is done running, which can cause the possible problems as
>> mentioned above.
>
> I am not very versed with pipes, but if the output/result/whatever of
> a script/program is directed elsewhere (>/dev/null ...) then this is a
> fork-off or new thread and the calling script would not wait for
> stuff?

[snip]

It's not the redirecting of stdout and stderr; it's the "&" character
at the end that causes a new process to be forked. However,
Subversion has recently acquired a new "feature" whereby if you do
not also redirect stdout and stderr somewhere, Subversion will still
wait for that forked process to end before returning from the hook
script.

-- 
To reply to the mailing list, please use your mailer's Reply To All  
function
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Mar 17 23:29:53 2007

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.