Re: [go-nuts] Closing write side of os.Pipe caused different behaviors

2024-11-10 Thread huan xiong
external process and thus creates a second reference > to the write side of the pipe. Which is why adding a tiny sleep before the > close "fixes" the problem. > > > On Thu, Nov 7, 2024 at 9:36 PM huan xiong wrote: > >> Hi, I wonder why the two programs below

[go-nuts] Closing write side of os.Pipe caused different behaviors

2024-11-07 Thread huan xiong
Hi, I wonder why the two programs below have different behaviors? Both start `yes` command, close write side of the pipe (because the main process doesn't use it), and read from the read side of the pipe. The only difference is one doesn't use goroutine and another uses it. 1) The first progra