J
Jeff 'japhy' Pinyan
Here is a very simple demonstration of my problem:
#!/usr/bin/perl
BEGIN {
my @args = ($^X, $0, @ARGV);
warn "$$: [@args]\n";
$SIG{USR1} = sub {
warn "$$: re-exec()ing with [@args]\n";
exec @args;
};
}
while (1) { }
I call that code 'exec.pl', and run it thus:
% perl exec.pl arg &
and I get
1234: [/usr/bin/perl exec.pl arg]
Then I send it a USR1 signal (numerical value is 10):
% kill -10 1234
and I get
1234: re-exec()ing with [/usr/bin/perl exec.pl arg]
1234: [/usr/bin/perl exec.pl arg]
Then I try to send it the signal again... and nothing. No messages at
all. But the program is running, with the same PID... I'm baffled.
#!/usr/bin/perl
BEGIN {
my @args = ($^X, $0, @ARGV);
warn "$$: [@args]\n";
$SIG{USR1} = sub {
warn "$$: re-exec()ing with [@args]\n";
exec @args;
};
}
while (1) { }
I call that code 'exec.pl', and run it thus:
% perl exec.pl arg &
and I get
1234: [/usr/bin/perl exec.pl arg]
Then I send it a USR1 signal (numerical value is 10):
% kill -10 1234
and I get
1234: re-exec()ing with [/usr/bin/perl exec.pl arg]
1234: [/usr/bin/perl exec.pl arg]
Then I try to send it the signal again... and nothing. No messages at
all. But the program is running, with the same PID... I'm baffled.