natefinch / pie

a toolkit for creating plugins for Go applications
MIT License
762 stars 59 forks source link

client.Close() blocks on Windows #13

Open timpaulshh opened 7 years ago

timpaulshh commented 7 years ago

Hey, using pie I've noticed that calling Close() on the client returned by pie.StartProviderCodec does not seem to work running on Windows. The call just blocks indefinitely. Your own sample code can be used to reproduce this issue. On Linux everything runs fine. I'm not sure if this is an issue with pie specifically or with Go's implementation of RPC. A quick Google search didn't bring up anything. Any ideas what could be the problem? I'm using Windows 10 and Go 1.7.

timidev commented 7 years ago

I meet the same problem. I'm using Windows 7 and Go 1.8. Can you fix this please?

natefinch commented 7 years ago

I'll take a look, thanks for letting me know.

On Thu, Aug 24, 2017, 4:03 AM timidev notifications@github.com wrote:

I meet the same problem. I'm using Windows 7 and Go 1.8. Can you fix this please?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/natefinch/pie/issues/13#issuecomment-324563680, or mute the thread https://github.com/notifications/unsubscribe-auth/ADCcyF8gtvFBbevakl1tyQ90dkIubu9Mks5sbS5ggaJpZM4KMz-y .

timidev commented 7 years ago

I fixed this problem. iop.ReadCloser.Close() will block in windows 7 , I change the close squeue and fix it. Changing like bellow: // Close closes the pipe's WriteCloser, ReadClosers, and process. func (iop ioPipe) Close() error { var err error if writeErr := iop.WriteCloser.Close(); writeErr != nil { err = writeErr } err = iop.ReadCloser.Close() if procErr := iop.closeProc(); procErr != nil { err = procErr } return err }

fix.patch.txt