Comment detail

指定コマンドを別プロセスで起動 (Nested Flatten)

詳しくは

perldoc perlipc

にて。

Dan the Perl Monger

1
2
3
4
5
6
7
8
my @cmd = qw/ps ux/;
my $pid = open my $rfh, '-|'
  or exec @cmd              # pid = 0
  or die "can't exec:$!"    # $! knows how it failed;
  while ( my $line = <$rfh> ) {
    print "[$pid] $line";
}
warn "exit status:$?";

Index

Feed

Other

Link

Pathtraq

loading...