Run Process Trigger

Top  Previous  Next

The Run Process Trigger allows you to launch any Windows process and trigger a build based on what happens.

 

Triggering can be based on any of three things:

 

Process output

 

The process exit code

 

Files modified while the process is running

 

 

Example

 

The example given below uses GNU WGet (for Windows) to monitor a remote URL and trigger the build if the file changes.

 

The URL we will monitor is the trial download of FinalBuilder. Any time it changes, we want to trigger a build.

 

 

RunProcessTrigger_Example

 

 

Process Name

The name of the process to run. This time we didn't actually need to put the full path here, because 'wget.exe' is on the system PATH of the server computer.

 

Working Directory

The directory to run the process in. In this case, this will be the directory that the remote URL is download to.

 

Arguments

The command line argument, '-N', tells WGet not to download the file unless it is newer than the version on disk.

 

Verbose Logging

Specifies that the Project Trigger Log will be filled with all the output from the executable each time it runs, as well as some extra information on trigger matching. This option produces a lot of log output, but it can be useful when setting up the trigger.

 

 

 

RunProcessTrigger_TriggerOnProcessOutput

 

Process Output

Searches the output of the program that is executed and matches the text specified. You can choose whether to trigger the build when the text is found or when the text is not found. In the example, we search the output of WGet to find the text 'Server file no newer then local file' and trigger the build if the string is not found.

 

 

 

RunProcessTrigger_TriggerOnExitCode

 

Exit Code

Compares the exit code returned by the process run against the specified value(s). In this example, we do not require that the exit code be tested.

 

Tip: Process exit codes can be quite unpredictable. It's recommended that you use one of the other trigger methods when possible.

 

 

 

RunProcessTrigger_TriggerOnFileChanges

It is not necessary to have 'Trigger On Files Changes' as well as 'Trigger on Process Output'. They're both enabled just for the sake of the example.

 

Monitor File Path

FinalBuilder Server will monitor the downloaded file and trigger whenever it changes. Alternatively, you could specify the entire C:\Temp directory in order to trigger whenever any file in the directory changes.

 

Note: The trigger can't actually tell whether the files change because of the process running, or for some other reason. It's best if you use a 'sandbox' directory where you can control  what processes make changes.

 

 

Feedback

 

There are two main ways to get feedback from the Run Process Trigger.

 

The first is to use the 'Verbose Logging' option and look at the process output in the Project Trigger Log.

 

The second is to go to the Edit Trigger page after the trigger has run, and click on the link to Show Last Output:

 

RunProcessTrigger_LastRunOutput

 

Once clicked, the section expands to look like this:

 

RunProcessTrigger_LastRunOutputExpanded

 

Note: This output does not refresh until you reload the entire page in your browser.

 

 

If the process has been running for more than one minute, you will be given the option to Terminate it. See the Trigger Errors topic for details.