Write to Process takes two tries...

Glen Bojsza gbojsza at gmail.com
Tue Nov 12 10:48:08 CET 2013


Hello everyone,

It may be a linux issue but when I open an SSH process and then write to
that process I need to do the write twice to get results. The interesting
thing is that I get double results.

For example when using the following script...the process is already open
for updates.


*on* mouseUp

   *write*  "pwd" & cr to process the nM of this stack

   readloop

*end* mouseUp


*command* readloop

   *read* from process the nM of this stack until empty

       *if* it is not empty  *then*

          *put* it & cr after fld sshResults

          *send* "readloop" to me in 1 tick

      *else*

         *exit* to top

      *end* *if*

*end* readloop

I don't get any results while waiting for my read from process no matter
how long I wait.

But if I send the write command twice then I get immediate results with pwd
being done twice?

pwd

/etc

[root at localhost etc]#

pwd

/etc

[root at localhost etc]#


I have tried adding an addition cr in the command

write "pwd" & cr & cr to process mySSH

but this doesn't do anything unless I send it twice and I get an additional
command line prompt back

pwd

/etc

[root at localhost etc]#

[root at localhost etc]#

pwd

/etc

[root at localhost etc]#

[root at localhost etc]#


I have tried combination of cr and lf but it still needs to write twice to
get results?

thanks,

Glen


More information about the use-livecode mailing list