Open Process on OSX
Samuel M. Smith
smithsm at samuelsmith.org
Tue Oct 18 16:40:56 EDT 2005
>> I never can read from the process once the process tries to read
>> from runrev
>> The write was correctly received by the process because it gets
>> written to the file in the process
>> However runrev doesn't manage reads by the process correctly since
>> I can't read from the process by runrev
>> once the process tries to read from runrev.
>> Looks like a bug.
> I think what is happening is that the pointer has moved to the end
> of the data and there is nothing left to read. I haven't
> specifically used the "open/read process" commands, but it looks
> like they function exactly the way opening and reading files does.
> If so, every read and write moves the current location of the
> pointer to the end of the string just read or written. When you
> read the first line, the pointer is at the end of that line.
> Reading the next line moves it to the end of the second line.
> Writing a line then moves it to the end of the third line. If you
> then issue another "read" command, you are at the end of the file
> and there is nothing to read.
> To read the third line in this situation, you must include the
> "start" position in the "read" command, which should indicate the
> character offset of the third line. You'll have to parse this. If
> you are storing the parts you've read so far in a variable, the
> offset would be the length of the stored variable, for example.
If so it would be make it really annoying to manage an interactive
I haven't had time to test your suggestion but I already did a test
where the first thing I did was write to the process
before I read anything and the subsequent reads from the process
worked fine. This behavior seems inconsistent with your suggestion.
I will test and verify however
thanks for the suggestion
More information about the Use-livecode