[Pdx-pm] Reading process output fails prematurely?
sgarman at zenlinux.com
Thu Mar 5 10:00:24 PST 2009
Michael G Schwern wrote:
>> open(EVENTS, "| /usr/local/sbin/udevmonitor");
> That means EVENTS is piping input into udevmonitor. You want to read output.
> You also want to make sure it open succeeded.
Aha, so all I needed was a slap with a clue bat. :) Thank you for your
response, and also for the lexical filehandle example.
> Are you sure you saw "I see:"? Because there's no way it should have worked
> as presented above, but you might have seen just udevmonitor's output. Do you
> have warnings on?
Right again - I was only seeing output from the program. I just *wanted*
to believe it was almost working the way I thought it should.
I have now turned warnings on and will keep them on for the remaining
development of the script.
A second quick question, if I haven't burned up too much karma: the
script works properly now, except that it buffers many lines (50+) from
udevmonitor before I see them on the screen. Setting $| to 1 was no
help, and from the documentation sounds like it wasn't quite what I
wanted anyway (autoflush forces buffer flushes after writes to the
currently selected output handle, and I'm guessing that input buffering
is what's causing me trouble).
sgarman at zenlinux dot com
More information about the Pdx-pm-list