microsoft / go-winio

Win32 IO-related utilities for Go
MIT License
939 stars 181 forks source link

Difficult to get pipe handle #290

Open funte opened 1 year ago

funte commented 1 year ago

The win32MessageBytePipestruct is unexported, its difficult to get the pipe handle, maybe should add this util function:

func UtilGetPipeHandle(f net.Conn) syscall.Handle {
    switch v := f.(type) {
    case *win32MessageBytePipe:
        return v.handle
    case *win32Pipe:
        return v.handle
    default:
        return 0
    }
}