Page 1 of 1

Weird Issue

PostPosted: Sat Dec 27, 2014 4:42 pm
by joshua
We are using Servoy for an order management app. Within this app there is a button for the user to click to export orders to our ERP system.

This export button, when clicked, launches a headless client. We then use object.queueMethod() to launch a function within this headless client. This function then launches a custom written exe on the servoy server with application.executeProgram which exports orders from our database to our erp system. The output from this exe is captured by the headless client and displayed to the user through a callback function.

This all works fine usually.

However, for other reasons, we've had to switch to using a batch file on the servoy server which uses psexec to launch the exe directly on the server for our erp in order to run the export. The export runs fine and the orders are moved as expected but oddly not all of the output is captured from the exe. Commonly only 1 line of output is captured. Sometimes, rarely, no output is returned.

When the batch file is ran directly from the servoy server all output is returned as expected. Just when running within the headless the output is behaving oddly.

Any idea what would cause the headless client to truncate the output?

I should add this output is written to a log file on the server also. The log file reflects the truncated export when running from the headless client and correctly shows the full output when running directly on the servoy server.

Re: Weird Issue

PostPosted: Sun Dec 28, 2014 9:45 am
by ROCLASI
Hi Joshua,

How is the output captured by the headless client?

Re: Weird Issue

PostPosted: Mon Dec 29, 2014 11:50 am
by jcompagner
We don't really control i think the output, thats just what Runtime.exec gives use back.
Are you sure if you run it through a batck file that that is not really running or spawning a separate process?
What log do you see is it the first lines or the last lines?

Maybe just write it to disk the output of the console and read that file back in?

Re: Weird Issue

PostPosted: Wed Dec 31, 2014 8:12 pm
by joshua
We've tried capturing the output two different ways

Here's the code that is launched within a headless client that is created with the onAction method of a button in our order management app.

Code: Select all
function runImporter() {
   application.output("BatchProcessor Starting", LOGGINGLEVEL.INFO)
   //var result = application.executeProgram('C:\\MASOrderImport\\MASOrderImport.exe', '#', '#', 'C:\\MASOrderImport\\');
   var result = application.executeProgram('C:\\MASOrderImport\\OrderImport.bat', '#', '#', 'C:\\MASOrderImport\\');

   //var result = plugins.file.readTXTFile('C:\\MASOrderImport\\log.txt')
   application.output(result, LOGGINGLEVEL.INFO)
   return result
}


We've tried with capturing the output directly into the result variable and also with reading the log.txt into the result variable file after running.

Both methods return the same results. The part of the expected log entry that is written to log.txt is the first line.

I removed capturing the output to result and grabbing the log.txt file and still the log file only shows the first expected line when the .bat is launched from servoy.

When running the bat natively on the server the log file is written in full as expected oddly.

Re: Weird Issue

PostPosted: Mon Jan 05, 2015 11:15 am
by jcompagner
the only thing i can think of is that the output after the second line is done as an error output

We don't capture the error output in the executeProgram call.

Not sure if you can see that when execution from the console (if it is error or just log output)