[PATCH] Clean up correctly on more signals

dinkypumpkin dinkypumpkin at gmail.com
Wed Oct 22 11:36:51 PDT 2014


On 22/10/2014 17:30, Mike Crowe wrote:
> On Monday 20 October 2014 at 17:30:27 +0100, dinkypumpkin wrote:
>> Looks like it would have worked well enough with SIGTERM.
>
> If you mean that adding SIGTERM as I did in my patch then I concur. run_cmd
> catches SIGTERM so there's probably no reason why the main program
> shouldn't too.

I only meant that handling SIGTERM should have killed rtmpdump. 
get_iplayer spends so little time outside run_cmd that handling SIGTERM 
elsewhere wouldn't have made much difference.

>> Possibly.  Both bits of signal handling just exit the program, which
>> isn't normally what I think of SIGHUP for.  You already have SIGTERM
>> where you need it (in run_cmd()), so maybe the author didn't think
>> it useful elsewhere.
>
> cleanup doesn't just exit - it appears to delete the lock files and named
> pipe. It looks like there is code that copes with stale lock files to some
> extent but it seems nicer to exit cleaner.

Couldn't hurt.  But - the named pipe is never used any more and the 
lockfile is only created for pvr runs.  Plus, unless you really are 
doing another pvr run, the lockfile always gets overwritten unless the 
previous invocation went zombie somehow. And the lockfile isn't cleaned 
up from run_cmd, which is almost always where signals get handled. 
Perhaps something you can clean up along the way.

> As I understand it SIGHUP may be received if the session ends and

True.  Never a bad idea to legislate for accidents.

> True, but Windows doesn't matter much to me. :-)

Fortunately, this is one of the few places I have that luxury where 
get_iplayer is concerned.

Feel free to make another patch and change the signal handling/cleanup 
however you like.  My only requirement is that you make it consistent 
between run_cmd and the rest of the script.




More information about the get_iplayer mailing list