On 12/17/12 3:34 AM, Fiedler Roman wrote:
> From your description, I would expect
>
> --- HYPOTHETICAL-OUTPUT---
> # ./FragmentedSend.py | ./BashReadTest
> Read status 142, value ""
> Read status 142, value "Stat" << the partial read
> FAILED READ: "us: OK"
> Traceback (most recent call last):
> File "./FragmentedSend.py", line 16, in
> os.write(1, nextSendData[0:sendLength])
> OSError: [Errno 32] Broken pipe
> --- HYPOTHETICAL-OUTPUT---
>
> Is this consistent with what you would be expecting!
I get the following with a few runs of the above code against a freshly-
built bash-4.2.39 (x24 is just a script that wraps the pipeline):
$ ./bash ./x24
Read status 142, value ""
Read status 142, value "Status:"
Read status 142, value ""
FAILED READ: "OK"
Traceback (most recent call last):
File "./FragmentedSend.py", line 16, in
os.write(1, nextSendData[0:sendLength])
OSError: [Errno 32] Broken pipe
$ ./bash ./x24
Read status 142, value ""
Read status 142, value "Statu"
Read status 142, value "s:"
FAILED READ: "OK"
Traceback (most recent call last):
File "./FragmentedSend.py", line 16, in
os.write(1, nextSendData[0:sendLength])
OSError: [Errno 32] Broken pipe
$ ./bash ./x24
Read status 142, value ""
Read status 142, value "Status: OK"
FAILED READ: ""
Traceback (most recent call last):
File "./FragmentedSend.py", line 16, in
os.write(1, nextSendData[0:sendLength])
OSError: [Errno 32] Broken pipe
$ ./bash ./x24
Read status 142, value "Sta"
Read status 142, value "tus: O"
FAILED READ: "K"
Traceback (most recent call last):
File "./FragmentedSend.py", line 16, in
os.write(1, nextSendData[0:sendLength])
OSError: [Errno 32] Broken pipe
I get the same results if I run the pipeline in an interactive shell.
This is pretty much what I expect. The whitespace and newlines will
disappear due to read's $IFS processing if they're first or last in
the string.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/