Skip to content

Commit

Permalink
Merge pull request #177 from creack/revert-nonblock-ioctl
Browse files Browse the repository at this point in the history
Revert #167 to avoid race on Linux.
  • Loading branch information
creack committed Nov 16, 2023
2 parents 2dfd24d + 8efd70a commit 3194d69
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,10 @@ jobs:
# Skip tests for 1.6 as we use modern Go.
# If the main lib builds and tests pass on other versions, we are good.
- if: ${{ matrix.go_version != '1.6.x' }}
name: Test
name: Single Test
run: go test -v

# Run the tests again 100 times without verbose.
- if: ${{ matrix.go_version != '1.6.x' }}
name: Many Tests
run: go test -count=100 -timeout=10s
4 changes: 4 additions & 0 deletions io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ var glTestFdLock sync.Mutex
//
//nolint:paralleltest // Potential in (*os.File).Fd().
func TestReadDeadline(t *testing.T) {
t.Skip("Disabling while investigating race.")

ptmx, success := prepare(t)

if err := ptmx.SetDeadline(time.Now().Add(timeout / 10)); err != nil {
Expand Down Expand Up @@ -57,6 +59,8 @@ func TestReadDeadline(t *testing.T) {
//
//nolint:paralleltest // Potential in (*os.File).Fd().
func TestReadClose(t *testing.T) {
t.Skip("Disabling while investigating race.")

ptmx, success := prepare(t)

go func() {
Expand Down
5 changes: 5 additions & 0 deletions ioctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ package pty
import "os"

func ioctl(f *os.File, cmd, ptr uintptr) error {
return ioctlInner(f.Fd(), cmd, ptr) // Fall back to blocking io.
}

// NOTE: Unused. Keeping for reference.
func ioctlNonblock(f *os.File, cmd, ptr uintptr) error {
sc, e := f.SyscallConn()
if e != nil {
return ioctlInner(f.Fd(), cmd, ptr) // Fall back to blocking io (old behavior).
Expand Down

0 comments on commit 3194d69

Please sign in to comment.