Skip Menu |

This queue is for tickets about the Term-Pulse CPAN distribution.

Report information
The Basics
Id: 89407
Status: new
Priority: 0/
Queue: Term-Pulse

People
Owner: Nobody in particular
Requestors: arfreitas [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.05
Fixed in: (no value)



Subject: bug in the stop_pulse function
Greetings, I got a bug in the stop_pulse function. The bug can be verified by introducing a exception with "die" in the calling code of pulse_start. This is the error message that I got: Can't kill a non-numeric process ID at E:/apps/strawberry/perl/site/lib/Term/Pulse.pm line 112, <DATA> line 1. By not checking if the $pid is defined and valid in stop_pulse function, this generates an error message that hides the real problem in my code. This is also confirmed by removing invocation of pulse_start. Just loading Term::Pulse with use() will cause this problem. This issue can be avoided by doing three things in pulse_stop: 1 - Checking if $pid is defined; 2 - Checking if the $pid is valid by trying "kill 0 $pid". With the signal 0, nothing will be done with the process besides checking if it is active. 3 - Traping the kill exception by using eval {}. It would be also interesting checking if there is an exception stored in $@ and use warn with it before calling kill(). Please let me know if you need more information or some test cases. I could try to provide a test for the distribution to check this expected behavior. Regards, Alceu