On Fri, Aug 25, 2017 at 11:09 AM, adam.azarchs via golang-nuts
<golang-nuts@googlegroups.com> wrote:
> TL;DR it would be nice if there were a public API to find the current signal
> disposition of your process.  The runtime already stores that information in
> runtime.sigtable, but doesn't expose it.
>
> I ran into a gotcha with handling SIGHUP the other day.  I need to handle
> SIGHUP in order to shut down gracefully.  However, nohup works by setting
> the process's signal disposition to ignore SIGHUP, and adding a handler
> un-ignores the signal, meaning the process shuts down when it shouldn't.
> Figuring out whether it was ignored, however, proved unpleasantly difficult.
> I know this would be straightforward enough to solve with cgo, but that
> opens us up to deployment difficulties for customers with older libc.  It's
> a bit aggravating that the runtime already has the information I want but
> doesn't give me a way to see it.  For the moment I'm just making the syscall
> but this seems like information the os/signal package should expose, for
> people who for example want to know what signal.Reset is resetting things
> *to*.

This seems reasonable to me.  I've seen it as being desirable in other
contexts.  If you can think of a good API to add the os/signal
package, please open an issue at https://golang.org/issue with a
proposal.  You make an important point--we need to report not just the
os/signal dispositions, but the internal runtime dispositions.
Thanks.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to