English 中文(简体)
Fork process with CC .NET
原标题:

Is there any way to fork a process inside Cruise Control .NET? I want CC .NET to launch a program when everything s done but right now, CC .NET insists on waiting for the program to close before saying that the build is complete.

The program that is launched must run for up to weeks at a time.

最佳回答

The way I would do it is to use a PowerShell or Batch script. The script can launch your process and return back normally to CC.NET after spawning the executable. This is the only way I can see doing it, as CC.NET does need to know it returned and the script can return, even with the process you spawned still out there running. A sample PowerShell script that will do what you want. Then you just call the powershell script with the path to the exe as a paratemeter.

    param(  [string] $exePath = $(throw "A path to executable required.")
    )

Invoke-Item $exePath

here on CC.NET 1.5 would be how to set up the powershell task

<powershell> 
    <script>yourScriptName.ps1</script> 
    <scriptsDirectory>D:CruiseControl</scriptsDirectory> 
    <buildArgs>full path to exe you want to kick-off</buildArgs>     
</powershell>
问题回答

How about this... 2 Small programs

1) A process that runs all the time (maybe a windows service?), and listens on a tcp socket, when it gets a connection, execute your 3 week process.

2) A process that can be called by CC.NET, and opens a tcp connection to process #1, and then exits.

You could use any form of inter-process communication, but TCP sockets are easy and reliable.

Put the launch of the program into a separate CCNET project and add a ForceBuildPublisher to the original project.

<project name="OriginalProject">
  <!-- ... -->
  <publishers>
    <!-- ... -->
    <forcebuild>
      <project>LaunchProgram</project>
   </forcebuild>
  </publishers>
</project>

I haven t tried the solution with powershell(the selected answer), but I use ruby rake and whatever I tried to fork independent process group with ruby library, CruiseControl STILL INSIST on waiting for the asynchronous process to finish.

For me; The only way to fork independent daemon process /server application successfully with CCNET is using task scheduler (https://stackoverflow.com/a/14679992/423356)

so use schtasks.exe to create a throwaway run once task to start your process

you can call schtasks and set the start time dynamically using batch file, ruby rake or powershell.





相关问题
Fork process with CC .NET

Is there any way to fork a process inside Cruise Control .NET? I want CC .NET to launch a program when everything s done but right now, CC .NET insists on waiting for the program to close before ...

SVN Externals in a different SCM

At a previous workplace we used svn externals to update dependent projects when a shared component was updated. This made it easy to see anything that those changes broke, as well as update dependent ...

Publishing an ASP.NET Website using buildpublisher

I am using the Cruise Control BuildPublisher task to publish a 2005 ASP.NET website. The Website has no warnings and if I run the Publish WebSite from within the IDE it works fine. When I publish ...

how to turn off a unit test in CPPUnit

I (finally) have my app being unit tested with CPPUnit and I have CruiseControl.NET running the tests and displaying the test output. I have several tests that always fail, however, so CruiseControl ...

Does a 64-bit CruiseControl.NET exist?

Does a 64-bit CruiseControl.NET exist or do I need to install the 32-bit version? Our CI server is Server2003 64-bit. Currently I have been testing on WinXP Pro and no problems. If I do need to run ...

CCNET reports build failure with no reason

We use CCNET 1.4.4.83 on Win 2003 SP2. A few days ago CCNET started to report build failures with no specific reason. The project contains a single exec task which runs build.bat. The batch does all ...

热门标签