Just another little snippet on things to watch out for when transitioning from Adobe CF to Railo. As I said last time when we discussed CFQueryParam these articles are not to pitch one engine against the other (Railo would clearly win :) ) more to expose things to look out for….though this one is definitely a minor bug in Railo….

Now, I haven’t 100% verified that this is still the case, but when I last checked there was a bug in CFExecute whereby any arguments containing spaces will not be treated properly and there doesn’t seem to be any way to escape them. Consider the following:

  <cfset a = ['/this_app/my file.txt'] />
  <cfexecute name="more" arguments="#a#" variable="b" timeout="4" />
  <cfdump var="#b#" /><cfabort />

It’s important that the second argument be escaped when passed to the system to execute – otherwise it’s going to look for a file called “/this_app/my” instead of “/this_app/my file.txt”.

Which is the exactly the error you get:

Error invoking external process – more[/this_app/my: not found

For us the solution is simply to make sure we never have to deal with arguments with spaces in. Suits us nicely but I’m sure there will be other occasions when it’s not so easily to come up with a solution.