10

I am new to Go, I want to create Named Pipes implementation in Go which works on both Windows and Linux.

I managed to get the code working on Ubuntu, but this one does not work on Windows

Isn't there any abstraction in Go which allows you to work with Named Pipes in both environment

Below is piece of my code

//to create pipe: does not work in windows    
syscall.Mkfifo("tmpPipe", 0666)    

// to open pipe to write    
file, err1 := os.OpenFile("tmpPipe", os.O_RDWR, os.ModeNamedPipe)    

//to open pipe to read    
file, err := os.OpenFile("tmpPipe", os.O_RDONLY, os.ModeNamedPipe)

Any help or pointers would help a lot. Thanks

Dave C
  • 7,729
  • 4
  • 49
  • 65
Pharaoh
  • 712
  • 1
  • 9
  • 33
  • This package provides a generic ipc interface which uses named pipes on windows: https://github.com/james-barrow/golang-ipc – smac89 Jul 25 '23 at 22:43

2 Answers2

10

According to https://github.com/golang/go/issues/3599

nate's package looks nice, and anyone can "go get" it.

A Windows named pipe implementation written in pure Go:
https://github.com/natefinch/npipe

Which has inspired (Win32 IO-related utilities for Go):
https://github.com/Microsoft/go-winio

Masci
  • 5,864
  • 1
  • 26
  • 21
4

There is an implementation of named pipes for Windows in Go from Microsoft:

https://github.com/Microsoft/go-winio

Dave C
  • 7,729
  • 4
  • 49
  • 65
Alexander Trakhimenok
  • 6,019
  • 2
  • 27
  • 52