burned by shell yet again
Björnke von Gierke
bvg at mac.com
Sun Mar 23 11:08:30 EDT 2008
Cool that actually works! Thank you very much. I have rerouted the
logging stuff wget outputs to /dev/null, as I'm really not interested
in that:
Code in button:
on mouseUp
launch "path/to/script/file" with "sh"
end mouseUp
Code in script file:
#!/bin/sh
wget -P/path/to/folder http://url.written.wrongly.on.purpouse.by.bjoernke.com
> /dev/null
Have Fun
Björnke
On 23 Mar 2008, at 15:37, GIRARD Damien wrote:
> Hi Bjoernke,
>
> If you do not want to pass through the shell() command with
> Revolution, you can use this trick that I am using.
>
> Rev create a shellscript file in a temporary folder.
> Your shellscript write results of your command in another file.
>
> Example:
> #!/bin/sh
> wget -P/path/to/folder http://url.written.wrongly.on.purpouse.by.bjoernke.com
> > myfile.txt
>
> Use the launch command to launch the shellscript (personnaly in
> order to stay compatible with all Unix operating system, I use /bin/
> sh).
> After, your rev app check every few seconds the content of myfile.txt.
>
> And you can monitor everything that you want with that.
>
> Note: I think that this work, I will try that once my Linux booted.
> (I developp on Windows).
>
> Regards,
>
> Damien
>
> Björnke von Gierke a écrit :
>> Hi
>>
>> On linux with the latest rc of 2.9, I am trying to get an url
>> asynchronous into a file, as to not reduce interactivity of my rev
>> stack. However I am unable to find a solution, without running a
>> second rev program, because shell behaves so strangely different in
>> Rev then in the terminal. My problem is that Rev always waits for
>> wget, no matter how I try to trick it. All my trials and successful
>> running tests in terminal didn't help me.
>>
>> The script I use is this (I used a wrong url because that results
>> in longer wait times for wget):
>>
>> wget -q -P/path/to/folder http://url.written.wrongly.on.purpouse.by.bjoernke.com
>> &
>>
>> -q no live logging to the terminal
>> -P custom path to save file under
>> & run command without waiting, return null immediately
>>
>> In terminal I noticed that the program does terminate immediately,
>> but sometimes output stuff, of which I know that Rev has problems
>> with. I presume these where information about the subtask spawned
>> by "&". Example:
>> [1] 24800
>>
>> So i put the string into a file, which i then called:
>>
>> bash downloadfile
>>
>> this did return immediately in the terminal, and didn't return
>> anything. Unfortunately, Rev still doesn't return control
>> immediately.
>>
>> I hate shell commands :(
>> Bjoernke
More information about the use-livecode
mailing list