Skip to main content
Participant
March 23, 2009
Question

CFExecute with error return

  • March 23, 2009
  • 2 replies
  • 2231 views
:confused;
Hi,

Earlier CF4.5 uses CFX_SpawnExec (dll) which launches the VB exe but not working with CF8.0
Installed CF8.0 in local machine and CFExecute successfully launched VB exe in synchronous, but it doesn't have any error return whether the execution is successful or unsuccessful.

Working Code (without error return)
<cfexecute name = "C:\ICS\Dll\Icsol.exe"
arguments = "-inf 99068614"
outputFile = ""
timeout = "60">
</cfexecute>

After some more search found CFExecute has one more argument errorVariable which returns if any error occurs,
but its working with a simple batch file but not while launching the VB exe.

Working
<cfexecute name = "C:\ICS\TestInforce.bat"
arguments = ""
errorVariable = "errVar"
timeout = "60"
variable="exResult">
</cfexecute>

Not working for VB exe
<cfexecute name = "C:\ICS\Dll\Icsol.exe"
arguments = "-inf 99068614"
errorVariable = "errVar"
timeout = "60"
variable="exResult">
</cfexecute>

Could someone suggest to use CFExecute with an errorVariable parameter to execute a VB exe.

thanks,
This topic has been closed for replies.

2 replies

Inspiring
March 26, 2009
Coldfusion8.0 wrote:
>
> Hi,
>
> Earlier CF4.5 uses CFX_SpawnExec (dll) which launches the VB exe but not
> working with CF8.0
> Installed CF8.0 in local machine and CFExecute successfully launched VB exe in
> synchronous, but it doesn't have any error return whether the execution is
> successful or unsuccessful.

I think you'll need to use java.lang.Runtime.exec which returns a
Process and has a method called exitValue().

--
Mack
Participant
March 26, 2009
Thanks Mack for your valuable suggestion,

Can we rely on this java exec, because I tried it and sometimes its not consistent in executing VB exe (like process hangs up in the task manager and do nothing)
things i have taken care:

CF8.0 apllication service: checked "allow service to interact with desktop"
CF8.0 administrator changed the Timeout value to 80 seconds (as our application vb exe will take around 60seconds to complete its job)
Code:
<cfset command = "C:\ICS\Dll\icsol.exe -inf 99068614">
<cfset runTime = CreateObject("java","java.lang.Runtime").getRuntime()>
<cfset process = runTime.exec(command)>
<cfset result = process.waitFor()>
<cfoutput> #result# </cfoutput>


could you please let me know is there any other way to capture the return code,
or do you suggest any 3rd party custom tags in the market that serves the purpose.



Thanks,
Shekar
Participant
March 26, 2009
hi,
Could some one help me on this issue

thanks