script

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package script 执行用户配置的 Shell 脚本,变量通过环境变量传入以避免注入。

Index

Constants

This section is empty.

Variables

View Source
var Timeout = 2 * time.Minute

Timeout 是单次脚本执行的超时。

Functions

func Prepare

func Prepare(cmd *exec.Cmd)

Prepare 让命令在独立进程组中运行,超时或取消时结束整个进程组,避免后台子进程残留并卡住输出读取。

func Run

func Run(content string, vars map[string]string) ([]byte, error)

Run 以 sh -c(Windows 为临时 .bat)执行脚本。每个变量同时以原名和 GATELY_ 大写前缀两种形式注入环境变量。

func Summarize

func Summarize(out []byte, limit int) string

Summarize 把输出整理为适合写日志的单段文本。

Types

This section is empty.

Jump to

Keyboard shortcuts

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