Samuel M. Smith wrote:
I can successfully open and read from a process but I can not get write
to process to work on OS X 10.4.2
at least not all the way.
First if I open process with text then runrev converts newlines to
carriage returns. This is
not correct for OS X. Especially unix processes which expect Unix
newlines.
If I open with binary I can append newline characters numtochar(10)
that will get sent OK.
The big problem is if I try to read in the process.
I am using a very simple test shell process
#!/bin/bash
#test.sh
echo "Hello there"
echo "Who are you?"
read DATA
echo "$DATA" > /Users/smithsm/Data/code/revolution/temp.txt
echo "$DATA"
echo "Goodbye"
This works from the command line in terminal
I put the process name into a text field named "Process"
I open it with
open process field "Process" for binary update
I read it with
read from process field "Process" until linefeed in 1 second
put the result into field "Result"
put it after field "BagRead"
I try to write with
put field "BagWrite" into bag
put bag & numtochar(10) into bag
write bag to process field "Process"
The behavior is as follows:
I open the process ok
I read the first line ok
I read the second line ok
I write
I try to read the third line and the result is timed out
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.
--
Jacqueline Landman Gay | [EMAIL PROTECTED]
HyperActive Software | http://www.hyperactivesw.com
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution