Re: [go-nuts] How to restore ignored signals

2021-05-24 Thread Manlio Perillo
On Sunday, May 23, 2021 at 12:29:47 AM UTC+2 Ian Lance Taylor wrote: > On Sat, May 22, 2021 at 5:53 AM Manlio Perillo > wrote: > > > > I'm curious to know if sigprocmask is safe/convenient to use in a Go > program. > > It's possible, of course, but it's not particularly convenient. > sigpro

Re: [go-nuts] How to restore ignored signals

2021-05-22 Thread Ian Lance Taylor
On Sat, May 22, 2021 at 5:53 AM Manlio Perillo wrote: > > I'm curious to know if sigprocmask is safe/convenient to use in a Go program. It's possible, of course, but it's not particularly convenient. sigprocmask isn't a good fit for multi-threaded programs, and most Go programs are multi-threaded

Re: [go-nuts] How to restore ignored signals

2021-05-22 Thread Manlio Perillo
On Friday, May 21, 2021 at 10:44:01 PM UTC+2 Ian Lance Taylor wrote: > On Fri, May 21, 2021 at 1:37 PM Manlio Perillo > wrote: > > > > [...] > > > > In https://play.golang.org/p/c88iu09mOgO, the SIGINT signal (via > Ctrl-C) is ignored after the call to `signal.Ignore`. > > However SIGINT i

Re: [go-nuts] How to restore ignored signals

2021-05-22 Thread Manlio Perillo
On Friday, May 21, 2021 at 11:43:24 PM UTC+2 Ian Lance Taylor wrote: > On Fri, May 21, 2021 at 1:47 PM Brian Candler wrote: > > > > If I understand rightly, it boils down to this: > > https://play.golang.org/p/vYlTzluIuBL > > Thanks. That's clearly a bug. The sig.ignored mask is not being >

Re: [go-nuts] How to restore ignored signals

2021-05-21 Thread Ian Lance Taylor
On Fri, May 21, 2021 at 1:47 PM Brian Candler wrote: > > If I understand rightly, it boils down to this: > https://play.golang.org/p/vYlTzluIuBL Thanks. That's clearly a bug. The sig.ignored mask is not being updated when it should be. > The documentation does say "Reset undoes the effect of a

Re: [go-nuts] How to restore ignored signals

2021-05-21 Thread Brian Candler
If I understand rightly, it boils down to this: https://play.golang.org/p/vYlTzluIuBL The documentation does say "Reset undoes the effect of any prior calls to Notify for the provided signals", without mentioning any effect on Ignore'd signals. On Frida

Re: [go-nuts] How to restore ignored signals

2021-05-21 Thread Ian Lance Taylor
On Fri, May 21, 2021 at 1:37 PM Manlio Perillo wrote: > > On Friday, May 21, 2021 at 10:22:08 PM UTC+2 Ian Lance Taylor wrote: >> >> On Fri, May 21, 2021 at 7:49 AM Manlio Perillo wrote: >> > >> > In a program I want to read a password from the terminal, using >> > golang.org/x/term. >> > The pr

Re: [go-nuts] How to restore ignored signals

2021-05-21 Thread Manlio Perillo
On Friday, May 21, 2021 at 10:22:08 PM UTC+2 Ian Lance Taylor wrote: > On Fri, May 21, 2021 at 7:49 AM Manlio Perillo > wrote: > > > > In a program I want to read a password from the terminal, using > golang.org/x/term. > > The problem is that there is a possibility that a signal is sent to

Re: [go-nuts] How to restore ignored signals

2021-05-21 Thread Ian Lance Taylor
On Fri, May 21, 2021 at 7:49 AM Manlio Perillo wrote: > > In a program I want to read a password from the terminal, using > golang.org/x/term. > The problem is that there is a possibility that a signal is sent to the > program, resulting in the terminal state not being restored: > https://play.g

[go-nuts] How to restore ignored signals

2021-05-21 Thread Manlio Perillo
In a program I want to read a password from the terminal, using golang.org/x/term. The problem is that there is a possibility that a signal is sent to the program, resulting in the terminal state not being restored: https://play.golang.org/p/4IjLve9gDx0 In case of term.ReadPassword, on Linux I n