Only trap sighup when the process is "backgrounded"

First step in working on the suggestion in https://github.com/amoffat/sh/issues/158.  It looks like this fails to terminate the children in my case.  I'm guessing that OProc.output_thread is still active in my case, I need to test that, but in the mean time I'd like to make sure that this approach will be useful.