For some reason, this does not seem to work for `ssh` (at least on OS X) 
unless you have `ControlPath` in ssh config. Are there any side-effects of 
SysProcAttr that I could be missing?

On Friday, July 18, 2014 at 1:07:44 AM UTC-7, Ian Lance Taylor wrote:
>
> On Thu, Jul 17, 2014 at 8:12 PM, Hein Meling <hein....@gmail.com 
> <javascript:>> wrote: 
> > 
> > Your solution seems to work when then parent process exits cleanly. But 
> if 
> > you do: 
> > 
> > func main() { 
> > cmd := exec.Command("sleep", "15") 
> > cmd.Start() 
> > time.Sleep(20 * time.Second) 
> > } 
> > 
> > And CTRL-C the parent process before it exits cleanly, then also the 
> sleep 
> > process goes away. Does the same happen to your monkey.sh process? 
> > 
> > Moreover, my use case is actually somewhat more involved. That is, I 
> would 
> > like to do cmd.Wait() (from different goroutines), in order to monitor 
> the 
> > child processes, but I don't want the child processes to fail if the 
> parent 
> > fails. 
>
> ^C kills all the processes because on Unix typing ^C on the terminal 
> sends a signal to every process in the process group.  So you want to 
> have a child process that is in a different process group.  You do 
> that by setting Setpgid to true in the Cmd.SysProcAttr field. 
>
> 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