Cfexecute timeout=0 but still blocking mode

Hi all

I have issues executing a vbscript by using cscript.exe in non-blocking mode.

<cfexecute
       	name="C:\Windows\System32\cscript.exe"
        arguments="//nologo D:\scripts\somescript.vbs -v someparameter -i someotherparameter"
        timeout="0">
</cfexecute>

Regarding Lucee Docs here i can read this:

A timeout of 0 is equivalent to the non-blocking mode of executing. A very high timeout value is equivalent to a blocking mode of execution. The default is 0; therefore, the thread spawns a process and returns without waiting for the process to terminate.If no output file is specified, and the timeout value is 0, the program output is discarded.

However; let’s say the vbscript takes 15 seconds to run, my page stucks for 15 seconds. If i add WScript.Sleep 20000 at the end of the script, then the page stucks for 35 seconds until it returns.

I’m able to reproduce that cfexecute is running in ‘blocking’ mode regardless if the timeout is set to zero and/or if the timeout parameter is completely removed.

I’m converting an application from CF9 to Lucee. The command from above was executed in non-blocking mode on CF9: The page returned immediately as expected.

Btw: The second statement of the docs is not true as well:

If no output file is specified, and the timeout value is 0, the program output is discarded.

If i execute cfexecute as desribed above, then i do get the output of the script returned to the webpage. Another evidence that the script is executed in blocking mode even it should not; because in non-blocking mode there should be no output returned.

I’m running: 5.3.3.62

Did someone of you already experienced similar problems?

Best regards
Tom

Here is a possible workaround that works for me:

 <cfscript>
    args = createObject("java", "java.util.ArrayList").init();
    args.add("cmd.exe");
    args.add("/c C:\Windows\System32\cscript.exe //nologo D:\scripts\somescript.vbs -v someparameter -i someotherparameter");
    pb = createObject("java","java.lang.ProcessBuilder").init(args);
    pb.redirectErrorStream(true);
    proc = pb.start();
  </cfscript>
2 Likes