Add patch for getting pipe handles

This commit is contained in:
2025-11-09 15:08:28 -05:00
parent ad3df93bed
commit 46e8191923
2 changed files with 28 additions and 87 deletions
+23
View File
@@ -0,0 +1,23 @@
diff --git a/pipe.go b/pipe.go
index a2da663..ef933c1 100644
--- a/pipe.go
+++ b/pipe.go
@@ -122,6 +122,18 @@ type win32MessageBytePipe struct {
readEOF bool
}
+// GetPipeHandle returns the underlying handle of a pipe.
+func GetPipeHandle(f net.Conn) windows.Handle {
+ switch v := f.(type) {
+ case *win32MessageBytePipe:
+ return v.handle
+ case *win32Pipe:
+ return v.handle
+ default:
+ return 0
+ }
+}
+
type pipeAddress string
func (f *win32Pipe) LocalAddr() net.Addr {