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

Re: svn post-commit hook - forking a process

From: Steve Whitson <steven.whitson_at_gmail.com>
Date: Wed, 08 Oct 2008 10:00:01 -0500

Ryan Schmidt wrote:
>
> On Oct 7, 2008, at 12:32, Steve Whitson wrote:
>
>> I've worked up a post-commit hook that updates a working copy
>> following a commit. I used the technique in the FAQ on
>> website-auto-update using an exe with u+s since my working copy is
>> owned by me and the server process runs as nobody.
>>
>> That's all well and good... but my repository has over a dozen
>> externals (internal references) in it. While having the post-commit
>> update my working copy it takes about 45 seconds longer with any
>> commit (even a real small one).
>>
>> I tried forking the submit (using '&' in the post-commit borne
>> script)... but it sill hangs on until the subprocess completes. I
>> also tried doing a fork in my small c-exe. The process works when
>> called manually, but when using subversion the post-commit hook still
>> hangs on until the subprocess completes. I'm going to pursue running
>> this update as a batch job (at) if I don't find a better solution.
>>
>> Peforming a custom parsing of the changes and updating only pieces
>> (of the working copy) which are noted in the (svnlook) changed-dirs
>> seems a bit cumbersom.
>>
>> Any other ideas on solving this? Is there a way I can get the
>> post-commit hook to spawn a process and allow the post-commit process
>> to complete before the subprocess does?
>
> Yes. You must redirect stdout and stderr, otherwise Subversion is
> waiting for output on those streams. Example post-commit hook script:
>
>
> #!/bin/bash
>
> /path/to/script.sh >/dev/null 2>/dev/null &
>

Thanks much, that did the trick! :) It never dawned on me that
redirecting stderr would be necessary for the parent process to let go
of the subprocess.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-10-08 17:00:38 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.