Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; use IO::Pipe; my $cmd = "tasklist"; my $pipe = IO::Pipe->new(); $pipe->reader($cmd); while (my $line = $pipe->getline()) { print $line; last if $line =~ /^smss/; } $pipe->close(); C:\>R:\io_pipe_test.pl Image Name PID Session Name Session# Mem + Usage ========================= ======== ================ =========== ====== +====== System Idle Process 0 Services 0 + 24 K System 4 Services 0 + 300 K smss.exe 284 Services 0 1 +.140 K Terminating on signal SIGINT(2) C:\>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IO::Pipe hangs
by BrowserUk (Patriarch) on Sep 20, 2012 at 19:14 UTC | |
by Anonymous Monk on Sep 20, 2012 at 19:16 UTC | |
|
Re: IO::Pipe hangs
by choroba (Cardinal) on Sep 20, 2012 at 19:17 UTC | |
by Anonymous Monk on Sep 20, 2012 at 19:28 UTC | |
by BrowserUk (Patriarch) on Sep 20, 2012 at 20:00 UTC | |
by Anonymous Monk on Sep 20, 2012 at 19:47 UTC |