Yeah, sure. when I get something to show I will put it here.
Meanwhile here is example of how simple script using Perl IPC to read from external program may hangs :
$ cat test.pl
my $cmd = '/usr/sbin/sshuttle -v -D -r vagrant@127.0.0.1 192.168.0.0/24';
open(OUT, "$cmd 2>&1 |") || die "can't fork: $!";
while (my $l = <OUT>) {
print $l;
}
When I run test.pl it hangs:
$ perl test.pl
Starting sshuttle proxy.
Listening on ('127.0.0.1', 12300).
c : connecting to server...
vagrant@127.0.0.1's password:
c : connected.
Connected.
...
^C # I have to enter control C to finish my script
When run the same command directly, it does not hang:
$ /usr/sbin/sshuttle -v -D -r vagrant@127.0.0.1 192.168.0.0/24
Starting sshuttle proxy.
Listening on ('127.0.0.1', 12300).
c : connecting to server...
vagrant@127.0.0.1's password:
c : connected.
Connected.
$ # finishes without interruption ..
Sshutle information could be found here - https://github.com/apenwarr/sshuttle
But I provide it only __as example__. Probably other command will cause the same Perl/IPC behavior.
Any ideas why?
And yeah , with Capture::Tiny sshutle does not hang ...
|