Re: [go-nuts] Re: Measuring resource usage of child processes

2020-06-25 Thread Brian Candler
That goroutine is launched at the end of Cmd.Start , rather than in exec.CommandContext. That makes sense: you don't want to start the time bomb until the process has been assigned a pid. Cmd.Run just does Cmd.Start followed by Cmd.Wai

Re: [go-nuts] Re: Measuring resource usage of child processes

2020-06-25 Thread Ian Lance Taylor
On Wed, Jun 24, 2020 at 10:42 PM Brian Candler wrote: > > My problem is actually around exec.CommandContext. I mentioned > os.Process.Kill is because that's the interface that exec.CommandContext uses: > > > The provided context is used to kill the process (by calling > > os.Process.Kill) if the

Re: [go-nuts] Re: Measuring resource usage of child processes

2020-06-24 Thread Brian Candler
My problem is actually around exec.CommandContext. I mentioned os.Process.Kill is because that's the interface that exec.CommandContext uses : > The provided context is used to kill the process (by calling os.Process.Kill) if the context becomes d

Re: [go-nuts] Re: Measuring resource usage of child processes

2020-06-24 Thread Ian Lance Taylor
On Wed, Jun 24, 2020 at 2:53 AM Brian Candler wrote: > > I have a kind-of workaround. Firstly, I see that Go has the ability to start > a new session for the child with Setsid called. However on timeout I still > need to kill the process group (-pid) instead of the process, which I can do > b

[go-nuts] Re: Measuring resource usage of child processes

2020-06-24 Thread Brian Candler
I have a kind-of workaround. Firstly, I see that Go has the ability to start a new session for the child with Setsid called. However on timeout I still need to kill the process group (-pid) instead of the process, which I can do by implementing the context deadline manually: cmd := ex