Documentation ¶
Index ¶
- Constants
- func ChildPids(pid int) ([]int, error)
- func ExitCode(ctx context.Context, cmd *exec.Cmd, err error) (int, error)
- func KillProcessTree(pid int) error
- func RetryIfTextFileBusy(fn func() error) error
- func RunWithProcessTreeCleanup(ctx context.Context, cmd *exec.Cmd) error
- type Command
- type CommandResult
- type Stdio
Constants ¶
View Source
const ( // KilledExitCode is a special exit code value used by the "os/exec" package // when a process is killed. KilledExitCode = -1 // NoExitCode indicates a missing exit code value, usually because the process // never started, or its actual exit code could not be determined because of an // error. NoExitCode = -2 )
Variables ¶
This section is empty.
Functions ¶
func KillProcessTree ¶
func RetryIfTextFileBusy ¶
Types ¶
type CommandResult ¶
type CommandResult struct { // 只有在命令无法启动,或者已经启动但没有完成的情况下,才会弹出错误信息。 // 启动了但没有完成。 // // 特别是,如果该命令运行并返回一个非零的退出代码(比如1)。 // 这被认为是一个成功的执行,这个错误将不会被填入。 // // 在某些情况下,该命令可能由于与命令本身无关的问题而未能启动。 // 与命令本身无关。例如,运行器可能在一个 // 但未能创建沙盒。在这种情况下,这里的 // 这里的Error字段应填入一个gRPC错误代码,说明为什么该 // 而ExitCode字段应该包含沙盒进程的退出代码。 // 而ExitCode字段应该包含来自沙盒进程的退出代码,而不是命令本身。 // // 如果对 "exec.Cmd#Run "的调用返回-1,意味着该命令被杀死或者 // 如果对`exec.Cmd#Run'的调用返回-1,意味着命令被杀死或从未退出,那么这个字段应填入一个gRPC错误代码,说明其 // 这个字段应该填入一个gRPC错误代码,说明原因,比如DEADLINE_EXCEEDED(如果命令超时),UNAVAILABLE(如果 // 有一个可以重试的瞬时错误),或RESOURCE_EXHAUSTED(如果该 // 命令在执行过程中耗尽了内存)。 Error error // Stdout from the command. This may contain data even if there was an Error. Stdout []byte // Stderr from the command. This may contain data even if there was an Error. Stderr []byte // ExitCode is one of the following: // * The exit code returned by the executed command // * -1 if the process was killed or did not exit // * -2 (NoExitCode) if the exit code could not be determined because it returned // an error other than exec.ExitError. This case typically means it failed to start. ExitCode int }
Click to show internal directories.
Click to hide internal directories.