mirror of
https://github.com/criyle/go-judge.git
synced 2025-11-04 14:50:02 +08:00
20 lines
231 B
Go
20 lines
231 B
Go
// +build !linux
|
|
|
|
package file
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
func (m *memFile) Open() (*os.File, error) {
|
|
r, w, err := os.Pipe()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
go func() {
|
|
defer w.Close()
|
|
w.Write(m.content)
|
|
}()
|
|
return r, nil
|
|
}
|