Jan 7, 2010

A small gotcha with cfexecute

This might get alot of people when running cfexecute consider this simple example of passing the result of the command dir back to ColdFusion:



It won't work. Why not? Because timeout is missing. It won't error on the cfexecute call but it will never get a result so dirResult wont exist.



While my example is Windows specific the timeout attribute is required when calling *nix command aswell.

3 comments:

  1. Timeout isn't missing in your first code block. Also, this is documented. Leaving off the timeout means, "Run it and don't' wait for the result." I'm not sure you were implying it was a bug, but I wanted to make sure folks knew this was expected.
    ReplyDelete
  2. Cut and paste error thanks Ray.

    No I'm not implying that it's a bug just a gotcha. The cfexecute does run there just isn't enough time to capture the result.
    ReplyDelete
  3. can you tell me what is the function of cfexecute?
    if you are looking for a cheap vps that is reliable and the uptime is 99.9%
    ReplyDelete