I agree with
JamesNC on this one, while it should be possible to fork after MainLoop and use CORE::exit, in reality it doesn't work reliably (or at all in most cases).
Ditto for many other things on win32, especially related to IPC, blocking, filehandles, shared memory, etc... This question (along with my last 50 or so...) relates to a project that i started a couple of months ago, developing a medium sized Tk app involving about 6-7 different processes client-side and a handful of networking. Needless to say, i've run into many bugs along the way, and agree it's frustrating when things dont behave as documented or expected.
Back to the question.
In response to your program, it doesn't really address my problem. You're simply forking another process, using pipes to communicate, and polling each end while you wait for something to do. Keeps MainLoop running while you do stuff, sure, (been there, achieved that) but my question was more than that. So, no bucket just yet! :)
I've just simplified it by removing the requirement of stderr for the time being. This leaves two remaining issues: non-blocking read, and MainLoop. Solve the first, and the second shouldn't be an issue!
My output is now (varies):
read_stdout()
sysread() got 9 bytes:
[stdout1
]
read_stdout()
sysread() got 9 bytes:
[stdout2
]
<pause for 10 seconds>
read_stdout()
sysread() got 9 bytes:
[stdout3
]
read_stdout()
sysread() got 9 bytes:
[stdout4
]
read_stdout()
sysread() got 0 bytes:
[]
- ><iper
use japh; print;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.