Monday, September 08, 2008    
Home My Books Blog ColdFusion About Me Back    

Calendar
<< Sep 2006 >>
S M T W T F S
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
             

Search

Categories
 • Acrobat (2) [RSS]
 • Adobe (67) [RSS]
 • AdobeMAX06 (45) [RSS]
 • AdobeMAX07 (59) [RSS]
 • AdobeMAX08 (22) [RSS]
 • AIR (126) [RSS]
 • Appearances (118) [RSS]
 • Books (68) [RSS]
 • CFEclipse (14) [RSS]
 • ColdFusion (1143) [RSS]
 • Data Services (12) [RSS]
 • Fish Tank (2) [RSS]
 • Flash (103) [RSS]
 • Flex (365) [RSS]
 • Home Automation (3) [RSS]
 • Jobs (93) [RSS]
 • JRun (12) [RSS]
 • Labs (27) [RSS]
 • LiveCycle (21) [RSS]
 • MAX (157) [RSS]
 • Regular Expressions (12) [RSS]
 • RIA (4) [RSS]
 • SQL (37) [RSS]
 • Stuff (503) [RSS]
 • Tips (CF Studio) (80) [RSS]
 • Tips (CF) (795) [RSS]
 • Tips (Dreamweaver) (91) [RSS]
 • Tips (Flex Builder) (2) [RSS]
 • Using CF (136) [RSS]
 • Wireless (97) [RSS]

Other BLOGs
 • Charlie Arehart
 • Lee Brimelow
 • Ray Camden
 • Christophe Coenraets
 • Sean Corfield
 • Mihai Corlan
 • Cornel Creanga
 • John Dowdell
 • Danny Dura
 • Enrique Duvos
 • Steven Erat
 • Kevin Hoyt
 • Serge Jespers
 • Adam Lehman
 • Duane Nickull
 • Miti Pricope
 • Andrew Shorten
 • Ryan Stewart
 • James Ward
 • Greg Wilson
 • Full As A Goog

RSS Feeds
 • Feed
 • Subscribe

Join my mailing list and find out about new books and other topics of interest.

Thoughts, ideas, tips, musings, and pontifications (not necessarily in that order) by Ben Forta ...
NOTE: This is my personal blog, and the opinions and statements voiced here are my own.

Viewing By Entry / Main
September 11, 2006

A Couple Of <CFEXECUTE> Gotchas

Two little gotchas and tips pertaining to <cfexecute> that you should be aware of:

  • There is no way to tell <cfexecute> where to execute your command. If you need to be in a specific folder when the command is executed, you should execute a batch file or script, and have it change to the desired folder and then execute the command.
  • The <cfexecute> tag captures output (which can be returned, or saved to a variable or file). But only stdout output is captured, not stderr, and so if the command you are executing generates error messages to stderr you'll not see those in the captured output. The solution is to redirect stderr to stdout, if you are using Windows you can do this by adding the following to the end of the command to be executed: 2>&1

Related Blog Entries

TrackBacks
There are no trackbacks for this entry.

No trackback URL. Trackbacks are only allowed via interactive form.

Comments
I've always found that CFEXECUTE not to be as useful as CFX_CONSOLECOMMAND which I have modified to allow the choise of 2>&1 as an output as that can be very useful.
# Posted By Big Kev | 9/11/06 9:03 AM
One more: It's in the documentation, but this threw me for a loop. The CFExecute Tag is Async by default. This is nice for spawning lots of processes when you need a silent job done, but can be a pain if you end up running processes that need to be run one instance at a time.
# Posted By Sam Curren | 9/11/06 10:17 AM
Another issue I've noticed is make sure which "user" you are running as. I was setting up GnuPGP on a Windows system and it took some debugging time to figure out where the keychain was stored...
# Posted By Bob Clingan | 9/11/06 10:42 AM
The redirection that you mentioned should also work for Unix.
# Posted By Barry | 9/13/06 2:23 PM
There's a Java-based work-around which allows you to 'position' where a <cfexecute> (equivalent) call is run from. You can use the exec() method from java.lang.Runtime, as I outlined in the following post from a little while back:

http://tech.badpen.com/index.cfm?mode=entry&en...
# Posted By Tim Blair | 9/25/06 10:36 AM

  © Copyright 1997-2008 Ben Forta, All Rights Reserved