Skip to content

Commit

Permalink
refactor(term): move conpty out of windows (#43)
Browse files Browse the repository at this point in the history
* refactor(term): move conpty out of windows

To match golang/sys, the windows package should contain Windows specific
API calls. The conpty package is a high-level package that creates and
manages ConPty sessions, and thus wouldn't make sense to keep it under
windows.

* Update exp/term/conpty/conpty_other.go
  • Loading branch information
aymanbagabas authored Feb 27, 2024
1 parent 03ee51d commit 0e636b3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions exp/term/conpty/conpty_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//go:build !windows
// +build !windows

package conpty

// ConPty represents a Windows Console Pseudo-terminal.
// https://learn.microsoft.com/en-us/windows/console/creating-a-pseudoconsole-session#preparing-the-communication-channels
type ConPty struct{}

// New creates a new ConPty.
// This function is not supported on non-Windows platforms.
func New(int, int, int) (*ConPty, error) {
return nil, ErrUnsupported
}
File renamed without changes.
5 changes: 5 additions & 0 deletions exp/term/windows/conpty/doc.go → exp/term/conpty/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
// https://learn.microsoft.com/en-us/windows/console/creating-a-pseudoconsole-session

package conpty

import "errors"

// ErrUnsupported is returned when the current platform is not supported.
var ErrUnsupported = errors.New("conpty: unsupported platform")
File renamed without changes.

0 comments on commit 0e636b3

Please sign in to comment.