Browse Source

fix aix compile error (#144)

* Fix windows compilation

* Fix compilation for AIX. Relates to #139

* Remove unused import for windows
Guillaume J. Charmes 4 months ago
parent
commit
d301b27172
3 changed files with 16 additions and 4 deletions
  1. 2 2
      ioctl.go
  2. 13 0
      ioctl_unsupported.go
  3. 1 2
      start_windows.go

+ 2 - 2
ioctl.go

@@ -1,5 +1,5 @@
-//go:build !windows && !solaris
-// +build !windows,!solaris
+//go:build !windows && !solaris && !aix
+// +build !windows,!solaris,!aix
 
 package pty
 

+ 13 - 0
ioctl_unsupported.go

@@ -0,0 +1,13 @@
+//go:build aix
+// +build aix
+
+package pty
+
+const (
+	TIOCGWINSZ = 0
+	TIOCSWINSZ = 0
+)
+
+func ioctl(fd, cmd, ptr uintptr) error {
+	return ErrUnsupported
+}

+ 1 - 2
start_windows.go

@@ -4,7 +4,6 @@
 package pty
 
 import (
-	"errors"
 	"os"
 	"os/exec"
 )
@@ -16,5 +15,5 @@ import (
 // This will resize the pty to the specified size before starting the command.
 // Starts the process in a new session and sets the controlling terminal.
 func StartWithSize(cmd *exec.Cmd, ws *Winsize) (*os.File, error) {
-	return nil, errors.New("unsupported platform")
+	return nil, ErrUnsupported
 }