Jump to content

Trigger error: System cannot find the file specified

Recommended Posts

Hello all,

First off, I'm a total noob on Plastic SCM, though I have plenty experience in other SCM systems. I liked the look & feel of the GUI, and after a few hours installing, configuring, and using it, I have to say I just love it. It works like a charm, and it's very intuitive to use, except for maybe a couple things, so here I am :)

I started using the Community Edition for a very small project with only 3 developers. The setup was very straightfroward and there's nothing special on the way the server is configured (next, next, finish... you know). Server is a Windows 7 x64 by the way, just in case this means anything. Clients are using Visual Studio 2008 for development, Plastic integrates just fine with it, as far as I can tell.

After a few days using it I noticed the checkout operation didn't automatically update the files in the operation, which started causing some annoyoing merge here and there, and I wanted to avoid this. After reading the manual and the online documentation for this I learned about triggers. Even more, the manual has just the trigger for it among other samples, so I copy-pasted the script from the sample into a text file, saved it as .rb file, and created the trigger pointing to the .rb file. All verbatim as it appears in the manual (http://www.plasticsc...iggersguide.pdf right at the bottom in the last page):

files = ''
STDIN.readlines.each do |line|
files << " " << line
system("cm update #{files}")

The problem is that when I do a checkout in the VS IDE, I get this error in the form of a pop-up (see attached picture): "Error trying to run trigger before-clientcheckout update before co The system cannot find the file specified."


Now, Ruby scripts are also a new for me, so I'm all lost about what does this error means:

Is it complaining that I'm lacking a Ruby compiler/interpreter in my machine? I was hoping Plastic SCM has it's onw way to run the scripts, but I might be wrong and I need to download a Ruby compiler?.

Is it complaining that Plastic is not finding the script? I tried different path approaches, down to the simplest C:\Temp\trigger.rb file path, so there would be no mistakes about it. Maybe due to a file permission problem? The folder was wide open from a security stand point, Everyone had full access to the path. Still the same error.

Is it complaining that the script is not good, and it's unable to find the file I'm trying to checkout? I can't tell just by looking at the script, as I said I'm a total stranger to Ruby, but I hope the script is ok since it's taken straight from the documentation.

I'm all out of ideas here. Could anyone please help me out? I would really appreciate it.

Thank you!


Link to comment
Share on other sites

Well, as it usually happen with newbie questions such as mine above, I ended up answering myself just minutes after posting the question :)

The solution was -of course- to install Ruby in my system. Now the script runs just fine. The only downside I can think of, is the ugly command-line window I get now every time I checkout a file. This is supposed to be Ruby running the script, so I guess I'll have to just let it be and move on. From the Ruby for Windows documentation I learned there is this executable file that doesn't open the annoying -and ugly- command-line window, called Rubyw, which is simply a backgroud version of Ruby, but so far I can't get Plastic to use this instead.

If anyone knows how to get Plastic running the script in background (without getting the cmd popup every time), I'd appreciate the tip.



Link to comment
Share on other sites

I created some trigger scripts, and didn't like the black command window popping up in the middle either. After some Googling (isn't that how we all figure stuff out anymore?) I found a way around it.

Instead of calling the trigger script itself (in your case your Ruby script), I have a vbs script that sets things up and then calls the trigger script (the vbs script takes a 1st argument which is the name of the trigger script; it assumes the scripts are located in the same directory).

The vbs script (I called it run_trigscript.vbs) is as follows:

' Create shell to run script

set wshshell = CreateObject("WScript.Shell")

' Get directory this script is located in

currdir = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))

' Get standard input for trigger (if present) as single string with space separated entries

dim triginput

do while WScript.Stdin.AtEndOfStream <> true


nextitem="""" & nextline & """" & " "

triginput=triginput & nextitem


REM WScript.Echo triginput

' Build full command for specified batch file, and call it

' (note that second arg = 2 for run command activates and runs minimized)

dim batcmd

if WScript.Arguments.Count < 2 then

batcmd = currdir & WScript.Arguments(0) & " " & triginput


batcmd = currdir & WScript.Arguments(0) & " " & WScript.Arguments(1) & " " & triginput

end if

REM WScript.Echo batcmd

result=wshshell.run(batcmd, 2, true)

' Clear shell variable

set wshshell = Nothing

' Return result returned from batch file


To activate the trigger on the server, use something like the following (doing this from memory, hope the syntax is right):

cm maketrigger before-clientcheckin "Expand keywords on checkin" "wscript.exe c:\PlasticSCM\Triggers\run_trigscript.vbs keyword_expansion.bat"

The part that hides the command window is the 2nd arg=2 in the wshshell.run() call.

Note that the vbs script also makes the standard input, if the trigger uses it, one string with each line separated by a space rather than a CR. Also note that it passes back the result from the called script, so Plastic knows whether the trigger passed or failed. I typically use batch files as "drivers" for my trigger scripts (they may call Perl scripts or other vbs scripts), so that made it easy to process something like a list of files in the batch file:

for %%a in (%*) do (

call :process_client_file %%a


Hope this helps!

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 months later...

I'm running into the same problem I am using Plastic 4.0 in a Windows env. I installed ruby on my windows client:

# Rails Environment Configuration.


bin: C:/RailsInstaller/Ruby1.9.2/bin/ruby.exe

version: ruby 1.9.2p290 (2011-07-09) [i386-mingw32]


bin: C:/RailsInstaller/Ruby1.9.2/bin/rails.bat

version: Rails 3.1.1

Using Plastic's trigger reference https://www.plasticscm.com/releases/4.0/manuals/en/triggersguide.pdf to create a simple label check. I made sure ruby scripts in general where able to run on my machine, inserted a print statement and ran the script in a terminal ok.


DiegoB@DIEGOBS-WS ~/plastic4.0_trigger_scripts

$ cm listtriggers

1 check label name C:\Users\DiegoB\plastic4.0_trigger_scripts\validate-labe

l.rb S-1-5-21-1454949469-1627925418-3665673473-4609 before-mklabel

DiegoB@DIEGOBS-WS ~/plastic4.0_trigger_scripts

$ cat validate-label.rb

#! C:/RailsInstaller/Ruby1.9.2/bin/ruby.exe

if (ENV['PLASTIC_LABEL_NAME'] !~ /^srs/) then exit(1) end


When I attempt creating a label I get the error below.


Error trying to run trigger before-mklabel check label name The system cannot find the file specified.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...