executeProgramInBackground problem

Hello,
I need to run this C:\curl-7.19.5\curl.exe “http://192.168.1.64:8983/solr/update?commit=true” -H “Content-Type: text/xml” --data-binary “13348” in servoy the same way I will do it in the console.

For this I have 1 solution …

var vFileSeparator = plugins.it2be_tools.client().fileSeparator
var vCurlSring = 'C:' + vFileSeparator + 'curl-7.19.5' + vFileSeparator + 'curl.exe "http://192.168.1.64:8983/solr/update?commit=true" -H "Content-Type: text/xml" --data-binary "<delete><id>' + '13348' + '</id></delete>"' + '\n';
var program_output = application.executeProgramInBackground(vCurlSring);

but it return undefine

If I run the string in the console is working good.

Do you have an idea what is wrong ? please

hi,

executeProgramInBackground will start your command in a separate thread and it
returns immediately, without waiting for the return of the command, and this is why
this function has no return

Guys, any idea why a curl command would execute perfectly and do what it’s expected to do in command line but would popup with runtime exception ‘Cannot execute external program’?
The command is something like this:

application.executeProgram(curl -u admin:admin http://192.168.0.161:8088/servoy-admin/clients/shutdown/client/71D29003-BAB5-41FA-9D5B-73EA79297324?confirm=Shutdown%21)

Nothing comes up in the server log.
Where could I get more information on what’s going on behind the scenes?

Cheers,
Maria

P.S. I’m trying to shutdown the client when the scheduler reaches a certain timeout.

the first parameter of application.executeProgram, is the program name, without its execution parameters, those are specified as separate parameters;
check the sample code of application.executeProgram for an example

maria:
Guys, any idea why a curl command would execute perfectly and do what it’s expected to do in command line but would popup with runtime exception ‘Cannot execute external program’?
The command is something like this:

application.executeProgram(curl -u admin:admin http://192.168.0.161:8088/servoy-admin/clients/shutdown/client/71D29003-BAB5-41FA-9D5B-73EA79297324?confirm=Shutdown%21)

Nothing comes up in the server log.
Where could I get more information on what’s going on behind the scenes?

Cheers,
Maria

P.S. I’m trying to shutdown the client when the scheduler reaches a certain timeout.

Gabi Boros:
the first parameter of application.executeProgram, is the program name, without its execution parameters, those are specified as separate parameters;
check the sample code of application.executeProgram for an example

My bad :oops:
It works now :)

Hi:

You can also create “on the fly” a .bat (windows) or .sh (linux/mac with attribute +x) with the command(s) to execute in console and call it with application. executeProgram.

I use this method when I have to launch several consecutive system commands or i have one repository of scripts on my database.

Adelo,

do you have an example of this code. I am trying to save a sound file .m4a and then convert it to wave on an OSX platform before ftping it from servoy.

I think i need to create a .sh file on the fly change to +X.

If you have a small example of a few lines of code that would be really helpful and save me a few hours!!!

Thanks

David

:)

David, this is for linux but applies to os x as well: http://www.linfo.org/create_shell_1.html

It describes in a few words how to create a shell script (.sh file) and how to make it executable (+x).

I hope this helps.

Thanks Marcel.

David