Skip to content

Commit

Permalink
Restore support for older Go versions
Browse files Browse the repository at this point in the history
When compiled with go older than 1.12 creack/pty will not include a fix
for blocking Read() and will be prone to data races - but at least it will work

For more information see issues: #88 #114 #156 #162
  • Loading branch information
sio committed Apr 28, 2023
1 parent 87d82d3 commit 418593d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions io_test.go
@@ -1,3 +1,6 @@
//go:build go1.12
// +build go1.12

package pty

import (
Expand Down
5 changes: 2 additions & 3 deletions ioctl.go
@@ -1,7 +1,6 @@
//go:build !windows
// +build !windows
//go:build !windows && go1.12
// +build !windows,go1.12

//
package pty

import "os"
Expand Down
10 changes: 10 additions & 0 deletions ioctl_legacy.go
@@ -0,0 +1,10 @@
//go:build !windows && !go1.12
// +build !windows,!go1.12

package pty

import "os"

func ioctl(f *os.File, cmd, ptr uintptr) error {
return ioctl_inner(f.Fd(), cmd, ptr) // fall back to blocking io (old behavior)
}

0 comments on commit 418593d

Please sign in to comment.