[Pdx-pm] Reading process output fails prematurely?
Scott Garman
sgarman at zenlinux.com
Wed Mar 4 23:33:23 PST 2009
Hello,
I'm writing a simple test program that does something I've done many
times with perl. It executes a long-running process and performs
blocking reads on the stdout of that process. Like so:
open(EVENTS, "| /usr/local/sbin/udevmonitor");
while (my $line = <EVENTS>) {
print "I see: $line";
}
When udevmonitor starts, it immediately prints out three lines, then
sits silently until it detects a udev event from the Linux kernel, which
it faithfully prints out.
Running the above snippet of code, however, starts udevemonitor as a
subprocess, prints "I see: <blah>" for those first three lines of
output, and then exits, leaving the udevmonitor process running in the
background.
I have, by the way, recompiled a version of udevmonitor that doesn't
print out that three-line preamble, and the perl script then exits
without printing anything - but again leaving the udevmonitor running in
the background.
I'm pretty sure udevmonitor isn't printing out EOFs. What else could I
be doing wrong?
I'm using perl v5.8.8 on Debian Etch.
Thanks,
Scott
--
Scott Garman
sgarman at zenlinux dot com
More information about the Pdx-pm-list
mailing list