From d301b27172d49dd53f82d18d37105669ba84fbe1 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Sun, 27 Mar 2022 10:49:54 -0700 Subject: [PATCH] fix aix compile error (#144) * Fix windows compilation * Fix compilation for AIX. Relates to #139 * Remove unused import for windows --- ioctl.go | 4 ++-- ioctl_unsupported.go | 13 +++++++++++++ start_windows.go | 3 +-- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 ioctl_unsupported.go diff --git a/ioctl.go b/ioctl.go index 45ec757..3cabedd 100644 --- a/ioctl.go +++ b/ioctl.go @@ -1,5 +1,5 @@ -//go:build !windows && !solaris -// +build !windows,!solaris +//go:build !windows && !solaris && !aix +// +build !windows,!solaris,!aix package pty diff --git a/ioctl_unsupported.go b/ioctl_unsupported.go new file mode 100644 index 0000000..2449a27 --- /dev/null +++ b/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 +} diff --git a/start_windows.go b/start_windows.go index b3efdca..7e9530b 100644 --- a/start_windows.go +++ b/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 }