cmd

package
v0.0.0-...-6e2457b Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Stdout string // 标准输出
	Stderr string // 标准错误
	Code   int    // 错误码
	Err    error  // 包装错误
}

func Run

func Run(ctx context.Context, name string, args ...string) Result

Run 在给定的上下文中执行指定的命令,并返回执行结果。 它使用 context.Context 来支持取消操作,允许从运行的命令中传递信号。 此函数封装了 os/exec 包的 CommandContext 方法,简化了命令执行的过程。

Jump to

Keyboard shortcuts

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