exec
Types from the Go package exec (a library PocketBase builds on), as JavaScript sees them: they turn up as values of PocketBase's types and of hook events.
exec.Cmd
Cmd represents an external command being prepared or run.
A Cmd cannot be reused after calling its Cmd.start, Cmd.run,
Cmd.output, or Cmd.combinedOutput methods.
| Member | Type | |
|---|---|---|
path |
string |
Path is the path of the command to run. |
args |
Array<string> |
Args holds command line arguments, including the command as Args[0]. If the Args field is empty or nil, Run uses {Path}. |
env |
Array<string> |
Env specifies the environment of the process. Each entry is of the form "key=value". If Env is nil, the new process uses the current process's environment. If Env contains duplicate environment keys, only the last value in the slice for each duplicate key is used. As a special case on Windows, SYSTEMROOT is always added if missing and not explicitly set to the empty string. |
dir |
string |
Dir specifies the working directory of the command. If Dir is the empty string, Run runs the command in the calling process's current directory. |
stdin |
io.Reader |
Stdin specifies the process's standard input. |
stdout |
io.Writer |
Stdout and Stderr specify the process's standard output and error. |
stderr |
io.Writer |
|
extraFiles |
Array<(os.File | undefined)> |
ExtraFiles specifies additional open files to be inherited by the new process. It does not include standard input, standard output, or standard error. If non-nil, entry i becomes file descriptor 3+i. |
sysProcAttr? |
syscall.SysProcAttr |
SysProcAttr holds optional, operating system-specific attributes. Run passes it to os.StartProcess as the os.ProcAttr's Sys field. |
process? |
os.Process |
Process is the underlying process, once started. |
processState? |
os.ProcessState |
ProcessState contains information about an exited process. If the process was started successfully, Wait or Run will populate its ProcessState when the command completes. |
err |
Error // LookPath error, if any. |
|
cancel |
() => void |
If Cancel is non-nil, the command must have been created with CommandContext and Cancel will be called when the command's Context is done. By default, CommandContext sets Cancel to call the Kill method on the command's Process. |
waitDelay |
time.Duration |
If WaitDelay is non-zero, it bounds the time spent waiting on two sources of unexpected delay in Wait: a child process that fails to exit after the associated Context is canceled, and a child process that exits but leaves its I/O pipes unclosed. |
string() |
(): string |
String returns a human-readable description of c. It is intended only for debugging. In particular, it is not suitable for use as input to a shell. The output of String may vary across Go releases. |
run() |
(): void |
Run starts the specified command and waits for it to complete. |
start() |
(): void |
Start starts the specified command but does not wait for it to complete. |
wait() |
(): void |
Wait waits for the command to exit and waits for any copying to stdin or copying from stdout or stderr to complete. |
output() |
(): string|Array<number> |
Output runs the command and returns its standard output. Any returned error will usually be of type [*ExitError]. If c.Stderr was nil and the returned error is of type [*ExitError], Output populates the Stderr field of the returned error. |
combinedOutput() |
(): string|Array<number> |
CombinedOutput runs the command and returns its combined standard output and standard error. |
stdinPipe() |
(): io.WriteCloser |
StdinPipe returns a pipe that will be connected to the command's standard input when the command starts. The pipe will be closed automatically after Cmd.wait sees the command exit. A caller need only call Close to force the pipe to close sooner. For example, if the command being run will not exit until standard input is closed, the caller must close the pipe. |
stdoutPipe() |
(): io.ReadCloser |
StdoutPipe returns a pipe that will be connected to the command's standard output when the command starts. |
stderrPipe() |
(): io.ReadCloser |
StderrPipe returns a pipe that will be connected to the command's standard error when the command starts. |
environ() |
(): Array<string> |
Environ returns a copy of the environment in which the command would be run as it is currently configured. |
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.