in reply to capture output of tcpdump and PID
#!/usr/bin/perl use warnings; use strict; use IPC::Open3; my $pid = open3(\*WRITE, \*READ, 0, "/usr/sbin/tcpdump -i wlan0 "); #if \*ERROR is 0 (false), STDERR is sent to STDOUT print "pid $pid\n"; while(1){ select(undef,undef,undef,.01); # small delay if( sysread \*READ,$output,1024 ){ print "$output\n"; }else{ print "finished\n"; exit; } }
|
|---|