[PATCH] Clean up correctly on more signals

Mike Crowe mac at mcrowe.com
Wed Oct 22 09:30:12 PDT 2014


On Monday 20 October 2014 at 17:30:27 +0100, dinkypumpkin wrote:
> On 20/10/2014 15:05, Mike Crowe wrote:
> >This patch is rather old. I added it during a time that my Internet
> >connection was rather unreliable and I was killing off get_iplayer after a
> >certain period of time so that it didn't consume bandwidth during the
> >day. Perhaps it didn't help as much as I thought it did. I'll have another
> >look at it more carefully.
> 
> 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.

> >in this case anyway. It would seem logical for SIGHUP and SIGTERM to be
> >treated similarly to SIGINT though.
> 
> 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.

As I understand it SIGHUP may be received if the session ends and
get_iplayer is in the foreground process group. Since SIGHUP's default
disposition is to terminate the program it would seem logical to handle it
by calling cleanup.

> And of course, none of this really matters much on Windows.

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

Mike.



More information about the get_iplayer mailing list