I think the docs on os.Signal explain it:

The only signal values guaranteed to be present in the os package on all
systems are os.Interrupt (send the process an interrupt) and os.Kill (force
the process to exit). On Windows, sending os.Interrupt to a process with
os.Process.Signal is not implemented; it will return an error instead of
sending a signal.

So basically on some systems (Windows in particular), I think SIGTERM
doesn't really exist. On the other hand, os.Kill and os.Interrupt both make
sense on Windows - os.Interrupt can be intercepted to capture ctrl-C, and
os.Kill can be sent to force a process to stop.

On Tue, Apr 16, 2019 at 7:49 PM Nathan Fisher <nfis...@junctionbox.ca>
wrote:

> As an alternative should the docs be updated to use the syscall package
> signals directly?
> https://godoc.org/os/signal#Notify
>
> Feels mildly strange intermixing vars from os and syscall where each has
> it's own distinct convention for the signal names.
>
> The two signals found in os follow the standard Go convention for variable
> names (e.g. Interrupt). Whereas the syscall package uses a convention more
> akin to C (e.g. SIGINT) presumably a result of auto-generation or legacy.
>
> On Tue, 16 Apr 2019 at 23:36, Nathan Fisher <nfis...@junctionbox.ca>
> wrote:
>
>> Hello,
>>
>> Currently the *os* package defines the following signals:
>>
>> var (
>>     Interrupt Signal <https://godoc.org/os#Signal> = syscall 
>> <https://godoc.org/syscall>.SIGINT <https://godoc.org/syscall#SIGINT>
>>     Kill      Signal <https://godoc.org/os#Signal> = syscall 
>> <https://godoc.org/syscall>.SIGKILL <https://godoc.org/syscall#SIGKILL>
>> )
>>
>> Would it make sense to include a Term signal as well or were these
>> signals considered historical accidents?
>>
>> My argument for including Term/SIGTERM is that it's used to notify pods
>> of imminent shutdown in kubernetes.
>>
>> While it's simple enough to add a var to my app it feels unnecessary for
>> something that seems an increasingly common signal to handle.
>>
>> Thoughts?
>>
>> Kind regards,
>> --
>> Nathan Fisher
>>  w: http://junctionbox.ca/
>>
>
>
> --
> Nathan Fisher
>  w: http://junctionbox.ca/
>
> --
> 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.
>

-- 
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