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

RE: Subversion under Windows: Start programs asynchronously in hook script

From: Keith Moore <Keith.Moore_at_securency.com>
Date: Fri, 15 May 2009 10:24:31 +1000

I assume you a using Windows because you made reference to Cmd and Start.

The only way I could get the result you want was to use JScript. I setup the post-commit.bat file to start a JScript file, StartAsync.js. Inside the script I then started another command. Files below.

Post-commit.bat
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS

:batchMain
    SET thisFolder=%~dp0
    SET scriptHost=%SystemRoot%\System32\wscript.exe

    "%scriptHost%" "%thisFolder%StartAsync.js"
GOTO :EOF

ENDLOCAL

StartAsync.js
var winShell = new ActiveXObject("WScript.Shell");
var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
var scriptPath = WScript.ScriptFullName;
var asyncScriptPath = fileSystem.BuildPath(fileSystem.GetParentFolderName(scriptPath), "SomethingDoneAsync.js");

winShell.Run(asyncScriptPath);

SomethingDoneAsync.js
WScript.Sleep(30000); // Sleep for 30 seconds.

All of these files were in the same folder as the post-commit.bat file but they don't need to be. The winShell.Run() command can be any valid command line, it doesn't have to be another script.

Hope this helps.
Keith.

From: Gregor Bader [mailto:gregor.bader_at_microtronics.at]
Sent: Thursday, May 14, 2009 6:14 PM
To: users_at_subversion.tigris.org
Subject: Subversion under Windows: Start programs asynchron in hook script

Hi!

I tried to implement the start of some programs asynchronous within the hook script,
so the script finished (and the commit is finshed) before the program exits.

I tried "start progam" and "cmd /C start program" but nothing works! Every time the commit
is only finished after the program finishes.

In detail:
We are running Subversion & Redmine (www.redmine.org<http://www.redmine.org>) and use the command "ruby script/runner "Repository.fetch_changesets" -e production"
to update with each commit. This command can take a long time (20s - 30s) to complete and the commit is only finished after this time.

Someone can help?

best regards,
Gregor

#####################################################################################
Attention:
The information contained in this message and or attachments is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient
is prohibited. If you received this in error, please contact the sender and
delete the material from any system and destroy any copies.
#####################################################################################

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2264330

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-05-15 04:47:40 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.