Re: [go-nuts] How to signal(sigint) blocking goroutine

2018-08-10 Thread Dave Cheney
The context value you pass into record isn't used and running record in its own goroutine doesn't really add anything because the main goroutine just waits for the other goroutine to exit. The exit the second goroutine will be at least 1 second, but could be much longer. On Saturday, 11 August

Re: [go-nuts] How to signal(sigint) blocking goroutine

2018-08-10 Thread nateandjenn
Thanks for all the comments. I did finally figure it out. https://play.golang.org/p/ghCT6DCDLJz On lines 69-70 changed that code from and exec.Command to exec.Start allowing me to sleep for the desired amount of time and then signal(sigint) the command via cmd.Process.Signal(syscall.SIGINT)

Re: [go-nuts] How to signal(sigint) blocking goroutine

2018-08-10 Thread Space A.
> > The first step is to get the idea of signals out of your head. As I > said, you can not send a signal to a goroutine. It's the wrong > approach. > > Instead, create a context.Context value (e.g., context.Background)... > Hmm... *Do not communicate by sharing memory; instead, share memor

Re: [go-nuts] How to signal(sigint) blocking goroutine

2018-08-10 Thread Tamás Gulácsi
Juct use the same context to your ExecContexts and cancel it on success to make the other stop. -- 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+unsu

Re: [go-nuts] How to signal(sigint) blocking goroutine

2018-08-09 Thread Ian Lance Taylor
On Thu, Aug 9, 2018 at 6:51 PM, wrote: > > https://play.golang.org/p/mr58JS4WsJV > > Okay, I realize now that I didn't do a very good job in my first post of > explaining my problem, so I'll trying again. In the above code I need to > signal(sigint or sigterm) the exec.CommandContext on line 69

Re: [go-nuts] How to signal(sigint) blocking goroutine

2018-08-09 Thread nateandjenn
https://play.golang.org/p/mr58JS4WsJV Okay, I realize now that I didn't do a very good job in my first post of explaining my problem, so I'll trying again. In the above code I need to signal(sigint or sigterm) the exec.CommandContext on line 69 that is blocking so it will stop and finish the g

Re: [go-nuts] How to signal(sigint) blocking goroutine

2018-08-08 Thread nateandjenn
Thanks for the info. I will look at the context information. On Wednesday, August 8, 2018 at 12:20:11 AM UTC-4, Ian Lance Taylor wrote: > > On Tue, Aug 7, 2018 at 7:02 PM, > > wrote: > > > > https://play.golang.org/p/d5n9bYmya3r > > > > I'm new to the go language and trying to figure out ho

Re: [go-nuts] How to signal(sigint) blocking goroutine

2018-08-07 Thread Ian Lance Taylor
On Tue, Aug 7, 2018 at 7:02 PM, wrote: > > https://play.golang.org/p/d5n9bYmya3r > > I'm new to the go language and trying to figure out how to sigint a blocking > goroutine. in the playground code I included an infinite for loop to > simulate the blocking. In my real world use the for block wou