É
陈云星
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 bythe 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:
erl;
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
17 Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
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 bythe 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:
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
17 Mojo::IOLoop->start unless Mojo::IOLoop->is_running;