Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: IO::Pipe hangs

by choroba (Bishop)
on Sep 20, 2012 at 19:17 UTC ( #994737=note: print w/replies, xml ) Need Help??

in reply to IO::Pipe hangs

On Linux, it works (I used "ps x" as the command and /alpine/ as the regex.)
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: IO::Pipe hangs
by Anonymous Monk on Sep 20, 2012 at 19:28 UTC
    On Solaris it works as well. Something wrong with Windows implementation?
    C:\>perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32-x +64-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2011, Larry Wall Binary build 1402 [295342] provided by ActiveState http://www.ActiveSt Built Oct 7 2011 15:19:36 Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at, the Perl Home Pa +ge. C:\>
      Something wrong with Windows implementation?

      More of a platform difference -- a thread used instead of a fork.

      Use this instead:

      use strict; use warnings; my $cmd = "tasklist"; my $pid = open PIPE, "-|", $cmd or die $!; while (my $line = <PIPE> ) { print $line; last if $line =~ /^smss/; } close PIPE;

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

      Something wrong with Windows implementation?

      It doesn't hang for me with sysinternals pslist, Devel::VersionDump

      Perl version: v5.14.1 on MSWin32 (C:\perl\5.14.1\bin\MSWin32-x86-multi +-thread\perl.exe) Carp - 1.26 Devel::VersionDump - 0.02 Exporter - 5.66 IO - 1.25_04 IO::Handle - 1.31 IO::Pipe - 1.14 SelectSaver - 1.02 Symbol - 1.07 XSLoader - 0.15 strict - 1.04 warnings - 1.12

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994737]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2018-04-22 22:36 GMT
Find Nodes?
    Voting Booth?