get shell(xxx) not working? - Resolved

Are you using LiveCode to create server scripts or CGIs?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
MartinB2
Posts: 6
Joined: Sat Apr 23, 2011 9:33 am

get shell(xxx) not working? - Resolved

Post by MartinB2 » Thu Aug 03, 2017 1:17 pm

Hi,
I am using V8.1.6 of the community server and have come across an issue which I am not sure if it is a bug or the way that I am trying to use a built-in function.

I have used Windows Desktop Community V8.1.6 to create a .livecode stack with a number of functions and commands in it. I test the functions using the desktop stack by emulating the way they are to be called from a .lc web page so I know that they work as expected.

I have then written a number of .lc files a access them successfully via a browser. I use a number of JavaScript functions to call (using Get) and run functions and then display the returned data. Generally I have had no problem doing whatever I want to and using stacks to access data in MySQL databases manipulate the results and return formatted data to the web page for display.

However, I have found that using "get Shell(cscript.exe //nologo C:/xampp/htdocs/1234510087403.vbs)" causes an error. (the .vbs is fine as it tests OK from the command line and using the desktop IDE)
Testing via the desktop IDE works just fine but when called from a .lc page the result is...

stack "C:/xampp/Stacks/ServiceStacks/xyz.rev"
row 97, col 1: shell: can't run shell command ( /C "cscript.exe //nologo C:/xampp/htdocs/1234510087403.vbs")
row 97, col 1: shell: can't run shell command (cscript.exe //nologo C:/xampp/htdocs/1234510087403.vbs)
row 97, col 1: put: error in expression

I have also had a similar issue with using revCopyFile to work. Worked fine in the IDE but via a .lc page it returned an error (handler could not be found). But I managed to find a way around by using "put URL "binfile:path1/xxx1.xxx" into URL "binfile:path2/xxx2.xxx" which worked fine.

I have used exactly this same approach using the "get shell(cscript.exe //nologo C:/xampp/htdocs/xyz.vbs) about 3 years ago without a problem. unfortunately I don't know what version of the server I used back then.

Can anyone else replicate the issue or confirm that it must be an issue with my implementation?

All help appreciates.

Regards - Martin
Last edited by MartinB2 on Fri Aug 04, 2017 12:38 am, edited 2 times in total.

MartinB2
Posts: 6
Joined: Sat Apr 23, 2011 9:33 am

Re: not all functions working?

Post by MartinB2 » Thu Aug 03, 2017 6:19 pm

Sorted....

This is obviously something that has changed since the version of LiveCode community server I used 3 years ago.

To resolve the problem with the Shell(xxx) function not working I had to set the Shellcommand property beforehand.

I got a clue of what would fix it by searching the LiveCode Quality Control Centre website. Apparently there was an issue with Shell() not returning a result in a previous version that was recognised as a bug and fixed but the work around at the time was to set the shellcommand property, which as worked for this issue as well.

Not so sure it would fix the problem I was having with revCopyfile though.

Regards - Martin

Post Reply

Return to “CGIs and the Server”