Re: [go-nuts] What can cause a process launched via os.exec to sporadically die from SIGPIPE

2020-07-06 Thread Marcin Romaszewicz
Thanks for the tip, I wasn't aware that happened! I'll use os.Pipe. -- Marcin On Mon, Jul 6, 2020 at 4:45 PM Ian Lance Taylor wrote: > On Mon, Jul 6, 2020 at 4:42 PM Marcin Romaszewicz > wrote: > > > > Yes, I am using io.Pipe, and passing in the PipeWriter side of it as > Stdout and Stderr on

Re: [go-nuts] What can cause a process launched via os.exec to sporadically die from SIGPIPE

2020-07-06 Thread Ian Lance Taylor
On Mon, Jul 6, 2020 at 4:42 PM Marcin Romaszewicz wrote: > > Yes, I am using io.Pipe, and passing in the PipeWriter side of it as Stdout > and Stderr on Cmd. I'm glad you figured out the problem, but I want to note that you almost certainly want to be using os.PIpe rather than io.Pipe. io.Pipe i

Re: [go-nuts] What can cause a process launched via os.exec to sporadically die from SIGPIPE

2020-07-06 Thread Marcin Romaszewicz
Yes, I am using io.Pipe, and passing in the PipeWriter side of it as Stdout and Stderr on Cmd. I figured out the problem, though. The executable which I am launching is doing a write on a non-existent file descriptor upon shutdown, which generates a SIGPIPE, per strace: write(75, "\25\3\3\0\32,v\

Re: [go-nuts] What can cause a process launched via os.exec to sporadically die from SIGPIPE

2020-07-06 Thread Ian Lance Taylor
On Sun, Jul 5, 2020 at 4:14 PM Marcin Romaszewicz wrote: > > On Sun, Jul 5, 2020 at 1:05 PM Ian Lance Taylor wrote: >> >> On Sun, Jul 5, 2020 at 10:54 AM Marcin Romaszewicz wrote: >> > >> > I'm hitting a problem using os.exec Cmd.Start to run a process. >> > >> > I'm setting Cmd.Stdio and Cmd.St

Re: [go-nuts] What can cause a process launched via os.exec to sporadically die from SIGPIPE

2020-07-05 Thread Marcin Romaszewicz
On Sun, Jul 5, 2020 at 1:05 PM Ian Lance Taylor wrote: > On Sun, Jul 5, 2020 at 10:54 AM Marcin Romaszewicz > wrote: > > > > I'm hitting a problem using os.exec Cmd.Start to run a process. > > > > I'm setting Cmd.Stdio and Cmd.Stderr to the same instance of an io.Pipe, > and spawn a Goroutine to

Re: [go-nuts] What can cause a process launched via os.exec to sporadically die from SIGPIPE

2020-07-05 Thread Ian Lance Taylor
On Sun, Jul 5, 2020 at 10:54 AM Marcin Romaszewicz wrote: > > I'm hitting a problem using os.exec Cmd.Start to run a process. > > I'm setting Cmd.Stdio and Cmd.Stderr to the same instance of an io.Pipe, and > spawn a Goroutine to consume the pipe reader until I reach EOF. I then call > cmd.Start

[go-nuts] What can cause a process launched via os.exec to sporadically die from SIGPIPE

2020-07-05 Thread Marcin Romaszewicz
Hi All, I'm hitting a problem using os.exec Cmd.Start to run a process. I'm setting Cmd.Stdio and Cmd.Stderr to the same instance of an io.Pipe, and spawn a Goroutine to consume the pipe reader until I reach EOF. I then call cmd.Start(), do some additional work, and call cmd.Wait(). The runtime o