winpty

package
v0.0.1-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE uintptr = 0x20016
	STILL_ACTIVE                        uint32  = 259
)

Variables

View Source
var (
	ErrConPtyUnsupported = errors.New("ConPty is not available on this version of Windows")
)

Functions

func CreateConsoleProcessAttachedToPTY

func CreateConsoleProcessAttachedToPTY(hpc windows.Handle, commandLine, workDir string, envs []string) (*windows.ProcessInformation, error)

func CreateEnvBlock

func CreateEnvBlock(envv []string) ([]uint16, error)

CreateEnvBlock converts an array of environment strings into the representation required by CreateProcess: a sequence of NUL terminated strings followed by a nil. Last bytes are two UCS-2 NULs, or four NUL bytes. If any string contains a NUL, it returns (nil, EINVAL).

func EnableVirtualTerminalProcessing

func EnableVirtualTerminalProcessing() error

func SetRawMode

func SetRawMode() (inHandle, outHandle windows.Handle)

func WinCloseHandles

func WinCloseHandles(handles ...windows.Handle) error

WinCloseHandles This will only return the first error.

func WinConsoleScreenSize

func WinConsoleScreenSize() (size windows.Coord, err error)

func WinIsConPtyAvailable

func WinIsConPtyAvailable() bool

func WinIsDataAvailable

func WinIsDataAvailable(handle windows.Handle) (bytesAvailable int, err error)

Types

type ConPty

type ConPty struct {
	// contains filtered or unexported fields
}

func Start

func Start(commandLine string, options ...ConPtyOption) (*ConPty, error)

func (*ConPty) Close

func (cpty *ConPty) Close() error

Close all open handles and terminate the process.

func (*ConPty) Kill

func (cpty *ConPty) Kill() error

func (*ConPty) Read

func (cpty *ConPty) Read(p []byte) (int, error)

func (*ConPty) Resize

func (cpty *ConPty) Resize(width, height int16) error

func (*ConPty) Wait

func (cpty *ConPty) Wait(ctx context.Context) (uint32, error)

Wait for the process to exit and return the exit code. If context is canceled, Wait() will return STILL_ACTIVE and an error indicating the context was canceled.

func (*ConPty) Write

func (cpty *ConPty) Write(p []byte) (int, error)

type ConPtyOption

type ConPtyOption func(args *conPtyArgs)

func ConPtyDimensions

func ConPtyDimensions(width, height int16) ConPtyOption

func ConPtyEnvs

func ConPtyEnvs(envs ...string) ConPtyOption

func ConPtyWorkDir

func ConPtyWorkDir(workDir string) ConPtyOption

type HandleWrapper

type HandleWrapper struct {
	// contains filtered or unexported fields
}

func (*HandleWrapper) Close

func (h *HandleWrapper) Close() error

func (*HandleWrapper) GetHandle

func (h *HandleWrapper) GetHandle() windows.Handle

func (*HandleWrapper) Read

func (h *HandleWrapper) Read(p []byte) (int, error)

func (*HandleWrapper) Write

func (h *HandleWrapper) Write(p []byte) (int, error)

type StartupInfoEx

type StartupInfoEx struct {
	// contains filtered or unexported fields
}

func GetStartupInfoExForPTY

func GetStartupInfoExForPTY(hpc windows.Handle) (*StartupInfoEx, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL