[go-nuts] Re: is there an atexit?

2018-02-09 Thread Richard Wilkes
You could try something like 
this: https://github.com/richardwilkes/toolbox/blob/master/atexit/atexit.go

I think the discussion here has missed the primary reason I have such code 
in many of my programs: to cleanly shutdown when asked to terminate, either 
by CTRL-C or someone issuing a catchable kill command.

- Rich

On Saturday, February 20, 2010 at 9:29:08 AM UTC-8, David Roundy wrote:
>
> I've searched the package repository, and haven't found an atexit (or
> rather AtExit) function or its equivalent... but it seems like it'd be
> pretty painful to live without this functionality.  Are there plans to
> add this? It seems like a perfect complement to the new SetFinalizer,
> so that we could use a bufio.Writer without worrying about calling
> Flush(), just to avoid losing data.
>
> Am I missing something?
> -- 
> David Roundy
>

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


[go-nuts] Re: is there an atexit?

2018-02-09 Thread Dave Cheney
Your program has a data race in the exitcode variable. 

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


[go-nuts] Re: is there an atexit?

2018-02-09 Thread frederic . meyer . 77
Here there is a solution which is cheap to 
use: https://gist.github.com/ZaniaDeveloper/8a5e4b804a5d7335080d7a7647f08f92

>
>

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