Re: [go-nuts] How to correctly use exec.Command and properly clean up all pipes

2023-02-07 Thread Rich
Not sure if this helps at all, but I've stopped using Go's exec and use bitfield's script command. You can do so much more with it than you can with the standard exec and it's shorter to implement than Go's exec. https://github.com/bitfield/script On Monday, February 6, 2023 at 5:43:45 PM UTC-

Re: [go-nuts] How to correctly use exec.Command and properly clean up all pipes

2023-02-06 Thread 'Lucas Christian' via golang-nuts
Filed under https://github.com/golang/go/issues/58369. -- Lucas Christian Staff Software Engineer, Voice and SIP Connectivity On Fri, Feb 3, 2023 at 2:14 PM Ian Lance Taylor wrote: > On Fri, Feb 3, 2023 at 1:48 PM Lucas Christian > wrote: > > > > Thanks for the reply and confirmation—theoretic

Re: [go-nuts] How to correctly use exec.Command and properly clean up all pipes

2023-02-03 Thread 'Lucas Christian' via golang-nuts
Thanks for the reply and confirmation—theoretical but we have had systems fail this way before (including the system this codebase will eventually be deployed on). Of course practically once that happens, the go process leaking one more file descriptor is probably the least of our worries. For com

Re: [go-nuts] How to correctly use exec.Command and properly clean up all pipes

2023-02-03 Thread Ian Lance Taylor
On Fri, Feb 3, 2023 at 12:38 PM 'Lucas Christian' via golang-nuts wrote: > > Apologies for reviving an old thread, but thought this might be the most > efficient way to keep context. > > I'm looking at a similar issue Thomas encountered, but in this case I'm > concerned about how to handle error

Re: [go-nuts] How to correctly use exec.Command and properly clean up all pipes

2023-02-03 Thread 'Lucas Christian' via golang-nuts
Apologies for reviving an old thread, but thought this might be the most efficient way to keep context. I'm looking at a similar issue Thomas encountered, but in this case I'm concerned about how to handle errors returned from StdoutPipe()/StderrPipe() and properly clean up after that. e.g.:

Re: [go-nuts] How to correctly use exec.Command and properly clean up all pipes

2019-12-14 Thread Ian Lance Taylor
On Sat, Dec 14, 2019 at 7:40 PM wrote: > > I need to spawn a subprocess and I'm trying to use os/exec. I need to capture > stdout/err so I'm using Cmd.StdoutPipe and Cmd.StderrPipe . The problem I'm > having is how to correctly clean up the pipes after I am done. If Cmd.Start > works fine, all I n

[go-nuts] How to correctly use exec.Command and properly clean up all pipes

2019-12-14 Thread tomas . volf
Hello, I need to spawn a subprocess and I'm trying to use os/exec. I need to capture stdout/err so I'm using Cmd.StdoutPipe and Cmd.StderrPipe . The problem I'm having is how to correctly clean up the pipes after I am done. If Cmd.Start works fine, all I need to do is read everything and then cal