chinaxing has asked for the wisdom of the Perl Monks concerning the following question:
I open a socket in my main perl program,
than i execute a shell script :'/home/admin/t.sh',
when i use CTRL-C to interrupt the perl program,
i saw that the port '4444' was already openning by the shell script's program。
so,how to close the socket fd when the `system` function was executed ?
the $^F variable is unuseful.
very thanks !1 #!/bin/env perl 2 use Linux::Inotify2; 3 use Modern::Perl; 4 use Mojo::IOLoop; 5 6 $^F=0; 7 Mojo::IOLoop->server({ 8 port => 4444, 9 },sub{ 10 my ($stream,$chunk) = @_; 11 $stream->write('HTTP/1.1 200 OK'); 12 print " I am server \n"; 13 }); 14 15 system('/home/admin/t.sh &>/dev/null &'); 16
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: close_on_exec in Perl : close socket opened in parent process when fork child , is not working
by eyepopslikeamosquito (Archbishop) on Jan 17, 2013 at 11:18 UTC | |
by chinaxing (Acolyte) on Jan 18, 2013 at 02:56 UTC | |
Re: close_on_exec in Perl : close socket opened in parent process when fork child , is not working (explain?)
by tye (Sage) on Jan 17, 2013 at 19:58 UTC |