Re: Re-exec in perl

2016-10-04 Thread X Dungeness
On Tue, Oct 4, 2016 at 2:07 PM, X Dungeness wrote: > Here's a possibly relevant note in the docs for both "alarm" and > "sleep": > > It is usually a mistake to intermix "alarm" and "sleep" calls, > because "sleep" may be internally implemented on your system > with "alarm". > > > It

Re: Re-exec in perl

2016-10-04 Thread X Dungeness
Here's a possibly relevant note in the docs for both "alarm" and "sleep": It is usually a mistake to intermix "alarm" and "sleep" calls, because "sleep" may be internally implemented on your system with "alarm". On Tue, Oct 4, 2016 at 1:34 PM, Chas. Owens wrote: > The first alarm

Re: Re-exec in perl

2016-10-04 Thread Chas. Owens
The first alarm is in a different process (same PID different process) due to the exec. I am not sure what is happening, but in general it is never a good idea to do anything complex in a signal handler. On Tue, Oct 4, 2016 at 4:21 PM Shawn H Corey wrote: > On Tue, 04 Oct 2016 19:32:44 + >

Re: Re-exec in perl

2016-10-04 Thread Shawn H Corey
On Tue, 04 Oct 2016 19:32:44 + "Chas. Owens" wrote: > It looks like the problem exists at the C level as well. This code > doesn't work past the first alarm: Doesn't it say the alarm has to be reset by the code in the documentation? After all, you don't want a second alarm to go off before

Re: Re-exec in perl

2016-10-04 Thread Chas. Owens
It looks like the problem exists at the C level as well. This code doesn't work past the first alarm: #include #include #include #include #include int n; char s[10]; char* prog; int alarm_called = 0; void handle_alrm(int signo) { if (signo == SIGALRM) { execv(prog, (char*[]) { prog, s, NU

Re: Re-exec in perl

2016-10-04 Thread Chas. Owens
First, never use -w flag to enable warnings; use the warnings pragma instead. Second, you should not exec the script directly, you don't know if it is executable or not, and it could even wind up running under a different version of perl. Instead, you should exec same the interpreter that is runn