You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Keith Moore <Ke...@securency.com> on 2009/05/15 00:24:31 UTC

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

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@microtronics.at]
Sent: Thursday, May 14, 2009 6:14 PM
To: users@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@subversion.tigris.org].

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

Posted by we...@tigris.org.
Hi all!

Thanks for these suggestions. I found another way/program which works:
CPAU http://www.joeware.net/freetools/tools/cpau/index.htm

This runs just great!

best regards,
Gregor

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

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

Posted by Brian Erickson <er...@bauercontrols.com>.
> "Command "nul" not found"

Are you going to use the Script solution or do you want to try to find
Command.exe?  What version of Windows are you using?

Brian

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


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

Posted by Andrey Repin <an...@freemail.ru>.
Greetings, Brian Erickson!

> If you don't want to use JScript (it's probably the better solution) try
> this:
 
> start command nul /c <your program goes here>
 
> Note: cmd.exe doesn't support the nul paraemter.  So you have to use the
> old command.exe.  It's still part of XP and VISTA.

"Command "nul" not found"

And, please, don't top-post. Thanks.


--
WBR,
 Andrey Repin (anrdaemon@freemail.ru) 16.05.2009, <5:52>

Sorry for my terrible english...

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

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

Posted by Brian Erickson <er...@bauercontrols.com>.
If you don't want to use JScript (it's probably the better solution) try
this:
 
start command nul /c <your program goes here>
 
Note: cmd.exe doesn't support the nul paraemter.  So you have to use the
old command.exe.  It's still part of XP and VISTA.
 
Brian


________________________________

	From: Keith Moore [mailto:Keith.Moore@securency.com] 
	Sent: Thursday, May 14, 2009 8:25 PM
	To: users@subversion.tigris.org
	Subject: RE: Subversion under Windows: Start programs
asynchronously in hook script
	
	

	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@microtronics.at] 
	Sent: Thursday, May 14, 2009 6:14 PM
	To: users@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) 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=2274425

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].