zshell

package
v1.7.12 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 14 Imported by: 10

Documentation

Overview

Package zshell use a simple way to execute shell commands

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug = false
	Env   []string
	Dir   string
)

Functions

func BgRun

func BgRun(command string) (err error)

func BgRunContext added in v1.6.3

func BgRunContext(ctx context.Context, command string) (err error)

func CallbackRun added in v1.6.3

func CallbackRun(command string, callback func(out string, isBasic bool)) (<-chan int, func(string), error)

func CallbackRunContext added in v1.6.3

func CallbackRunContext(ctx context.Context, command string, callback func(str string, isStdout bool), opt ...func(option *Options)) (<-chan int, func(string), error)

func ExecCommand added in v0.1.29

func ExecCommand(ctx context.Context, command []string, stdIn io.Reader, stdOut io.Writer,
	stdErr io.Writer) (code int, outStr, errStr string, err error)

func ExecCommandHandle added in v0.1.64

func ExecCommandHandle(ctx context.Context, command []string,
	bef func(cmd *exec.Cmd) error, aft func(cmd *exec.Cmd, err error)) (code int,
	err error)

func OutRun

func OutRun(command string, stdIn io.Reader, stdOut io.Writer,
	stdErr io.Writer) (code int, outStr, errStr string, err error)

func PipeExecCommand added in v0.1.64

func PipeExecCommand(ctx context.Context, commands [][]string) (code int, outStr, errStr string, err error)

func Run

func Run(command string) (code int, outStr, errStr string, err error)

func RunBash added in v1.7.3

func RunBash(ctx context.Context, command string) (code int, outStr, errStr string, err error)

func RunContext added in v0.1.44

func RunContext(ctx context.Context, command string) (code int, outStr, errStr string, err error)

func RunNewProcess added in v0.0.21

func RunNewProcess(file string, args []string) (pid int, err error)

Types

type Options added in v1.6.4

type Options struct {
	Dir string
	Env []string
}

type ShellBuffer added in v0.1.31

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

func (*ShellBuffer) String added in v0.1.31

func (s *ShellBuffer) String() string

func (*ShellBuffer) Write added in v0.1.31

func (s *ShellBuffer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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