winpty

package
v0.0.0-...-3620956 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN       = 1
	WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN = 2

	WINPTY_FLAG_CONERR                         = 0x1
	WINPTY_FLAG_PLAIN_OUTPUT                   = 0x2
	WINPTY_FLAG_COLOR_ESCAPES                  = 0x4
	WINPTY_FLAG_ALLOW_CURPROC_DESKTOP_CREATION = 0x8

	WINPTY_MOUSE_MODE_NONE  = 0
	WINPTY_MOUSE_MODE_AUTO  = 1
	WINPTY_MOUSE_MODE_FORCE = 2
)

Variables

View Source
var (

	//windows api
	GetProcessId *syscall.LazyProc
)

Functions

func GetErrorCode

func GetErrorCode(err uintptr) uint32

func GetErrorMessage

func GetErrorMessage(err uintptr) string

func SetAgentTimeout

func SetAgentTimeout(winptyConfigT uintptr, timeoutMs uint64)

func SetMouseMode

func SetMouseMode(winptyConfigT uintptr, mode int)

func UTF16PtrFromStringArray

func UTF16PtrFromStringArray(s []string) (*uint16, error)

func UTF16PtrToString

func UTF16PtrToString(p *uint16) string

Types

type Options

type Options struct {
	// DllDir is the path to winpty.dll and winpty-agent.exe
	DllDir string
	// FilePath sets the title of the console
	FilePath string
	// Command is the full command to launch
	Command string
	// Dir sets the current working directory for the command
	Dir string
	// Env sets the environment variables. Use the format VAR=VAL.
	Env []string
	// AgentFlags to pass to agent config creation
	AgentFlags uint64
	SpawnFlag  uint32
	MouseModes int
	// Initial size for Columns and Rows
	InitialCols uint32
	InitialRows uint32
	// contains filtered or unexported fields
}

type WinPTY

type WinPTY struct {
	Stdin  *os.File
	Stdout *os.File
	Stderr *os.File
	// contains filtered or unexported fields
}

func OpenDefault

func OpenDefault(dllPrefix, cmd, dir string, isColor bool) (*WinPTY, error)

the same as open, but uses defaults for Env

func OpenWithOptions

func OpenWithOptions(options Options) (*WinPTY, error)

func (*WinPTY) Close

func (pty *WinPTY) Close() error

关闭进程

func (*WinPTY) GetAgentProcHandle

func (pty *WinPTY) GetAgentProcHandle() uintptr

func (*WinPTY) GetProcHandle

func (pty *WinPTY) GetProcHandle() uintptr

func (*WinPTY) GetStderr

func (pty *WinPTY) GetStderr() io.Writer

func (*WinPTY) GetStdin

func (pty *WinPTY) GetStdin() io.Reader

func (*WinPTY) GetStdout

func (pty *WinPTY) GetStdout() io.Writer

func (*WinPTY) Pid

func (pty *WinPTY) Pid() int

func (*WinPTY) SetSize

func (pty *WinPTY) SetSize(wsCol, wsRow uint32) error

设置窗口大小

Jump to

Keyboard shortcuts

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