You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Steve Whitson <st...@gmail.com> on 2008/10/07 17:32:42 UTC

svn post-commit hook - forking a process

Hi,

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?

Thanks much,
    -Steve


(subversion 1.5.2 on solaris using fsfs)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: svn post-commit hook - forking a process

Posted by Steve Whitson <st...@gmail.com>.
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@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: svn post-commit hook - forking a process

Posted by Ryan Schmidt <su...@ryandesign.com>.
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 &


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org