Re: shell() question

2015-07-23 Thread Mark Waddingham
The shell function inherits its environment from LC so there's no issue here. You can also use open process for update, write to it then read from it. The elevated version of open process prompts for authentication and then runs the process as administrator. It uses system support for UI based

Re: shell() question

2015-07-23 Thread Mark Waddingham
On the contrary, open process can be used in a non-blocking way - although you do need to poll using read until empty (which returns all available data at that point). (The read from process command could do with a callback form really - like read from socket has). I've done this before - you

Re: shell() question

2015-07-23 Thread David Bovill
Thanks Mark. I'm going to give open process for update a spin. Is this something that you would consider robust enough to be used in a long running server type context? So we can have a Livecode server communicating with these processes and serving out processed results over sockets to a web

shell() question

2015-07-23 Thread David Bovill
I'm wandering if there is a neat trick to pass data to a shell command via STDIN. The only thing I know how to do is either: 1. Write a bash script that accepts an input param and call this 2. put shell (echo 'some text' | shellThing) Is there a neater way?

Re: shell() question

2015-07-23 Thread David Bovill
Well I found one - though I'm not sure it is strictly legal: put some text into $LIVECODEVAR put shell (echo $LIVECODEVAR | shellThing -q) which is great. I don't think this pollutes the environment, as AFAIK shell() is in it's own space (like opening a tab in the terminal) - but are there

Re: Shell question

2012-01-09 Thread Pete
OK, I got this working. In order to get the correct linefeed characters for Unix, I had to open the output file in binary mode. Once I did that, everything worked fine. Pete On Sun, Jan 8, 2012 at 11:00 PM, Pete p...@mollysrevenge.com wrote: The command is in a variable, eg put

Re: Shell question

2012-01-09 Thread Bernard Devlin
Ah. The beauty of Livecode's OS X/Unix return substitutions. OS X is unix. Kind of. Until you shell out from Livecode. On Mon, Jan 9, 2012 at 5:42 PM, Pete p...@mollysrevenge.com wrote: OK, I got this working.  In order to get the correct linefeed characters for Unix,

Shell question

2012-01-08 Thread Pete
I suspect this is more of a Unix question than LC but here goes. I'm issuing a shell command to run a program and redirect its stdin to a file, so something like put shell(myprog /Users/Pete/myfile.txt) into myResult The Stdin file contains 3 or 4 lines that are valid input to myProg, one of

Re: Shell question

2012-01-08 Thread Mark Wieder
Pete- I've read through this a couple of times now trying to parse what you're trying to do. Here's my guess: you'd like to set up a text file of responses to prompts from the myProg program, which would be processed at the time myProg wants more input. If so, you should check out the expect

Re: Shell question

2012-01-08 Thread Michael Kann
Pete, Is your set-up  on the on-rev servers? Mike --- On Sun, 1/8/12, Pete p...@mollysrevenge.com wrote: From: Pete p...@mollysrevenge.com Subject: Shell question To: How to use LiveCode use-livecode@lists.runrev.com Date: Sunday, January 8, 2012, 7:52 PM I suspect this is more of a Unix

Re: Shell question

2012-01-08 Thread Pete
Hi Mark, The program in question is sqlite3. I'm trying to give it commands to export an sqlite table in the form of INSERT commands. The program is run by typeing: sqlite3 dbname after it has started I need to feed it the following commands: .mode sql .output outputfilename SELECT whatever;

Re: Shell question

2012-01-08 Thread Pete
Mi Michael, This is running on my desktop (OS X) Pete On Sun, Jan 8, 2012 at 6:24 PM, Michael Kann mikek...@yahoo.com wrote: Pete, Is your set-up on the on-rev servers? Mike --- On Sun, 1/8/12, Pete p...@mollysrevenge.com wrote: From: Pete p...@mollysrevenge.com Subject: Shell

Re: Shell question

2012-01-08 Thread Mark Wieder
Pete- Sunday, January 8, 2012, 6:54:44 PM, you wrote: Those commands all work fine when typed into the program by me but nothing is written to the output file if I redirect stdin to a file that contains them. Ah. In that case, are you putting quotes around the shell command? Works here for

Re: Shell question

2012-01-08 Thread Pete
The command is in a variable, eg put shell(myCommand) into myResult. I'm thinking it's something other than that though since even if I type the command directly into Terminal with the stdin redirection, no output is produced. sqlite3 has a .echo command which prints all the commands to stdin.