shellengine

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

README

脚本执行引擎

主要把操作系统的shell包装了一层方便上层调用,目前只支持 linux bash/shwindows powershell

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IOctl

func IOctl(fd int, request, arg uintptr) error

* * 系统调用 *

Types

type LinuxBashShell

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

func InitLinuxBashShell

func InitLinuxBashShell(rulex typex.RuleX) *LinuxBashShell

func (*LinuxBashShell) IOctl

func (lsh *LinuxBashShell) IOctl(fd int, request, arg uintptr) error

func (*LinuxBashShell) JustRun

func (lsh *LinuxBashShell) JustRun(ctx context.Context, cmd string) error

func (*LinuxBashShell) JustRunDetach

func (lsh *LinuxBashShell) JustRunDetach(ctx context.Context, cmd string) error

func (*LinuxBashShell) ReadFD

func (lsh *LinuxBashShell) ReadFD(fd int, p []byte) (n int, err error)

func (*LinuxBashShell) RunAndWaitResult

func (lsh *LinuxBashShell) RunAndWaitResult(ctx context.Context, cmd string) ([]byte, error)

func (*LinuxBashShell) RunWithInteractive

func (lsh *LinuxBashShell) RunWithInteractive(ctx context.Context, cmd string,
	in, out chan []byte) error

type ShellEngine

type ShellEngine interface {
	JustRun(ctx context.Context, cmd string) error                                 // 一次性指令,不等返回
	JustRunDetach(ctx context.Context, cmd string) error                           // 分离进程
	RunAndWaitResult(ctx context.Context, cmd string) ([]byte, error)              // 运行指令然后等待结果
	RunWithInteractive(ctx context.Context, cmd string, in, out chan []byte) error // 交互运行,自带stdin
	ReadFD(fd int, p []byte) (n int, err error)                                    // Syscall read
	IOctl(fd int, request, arg uintptr) error                                      // UNIX ioctl
}

* * 脚本执行引擎 *

type WindowsPowerShell

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

func InitWindowsPowerShell

func InitWindowsPowerShell(rulex typex.RuleX) *WindowsPowerShell

Jump to

Keyboard shortcuts

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