Files
creack.pty/fd_helper_zos_test.go
2024-10-31 10:42:45 -04:00

21 lines
423 B
Go

//go:build zos
// +build zos
package pty
import (
"os"
"testing"
)
func getNonBlockingFile(t *testing.T, file *os.File, path string) *os.File {
t.Helper()
// z/OS doesn't open a pollable FD - fix that here
if _, err := fcntl(uintptr(file.Fd()), F_SETFL, O_NONBLOCK); err != nil {
t.Fatalf("Error: zos-nonblock: %s.\n", err)
}
nf := os.NewFile(file.Fd(), path)
t.Cleanup(func() { _ = nf.Close() })
return nf
}