Import std.os.process_command
std.os.process_command
Command, a program to start, with its arguments, environment, folder, and streams, and no shell, so each argument reaches it as it is, on every OS: Spawn starts it beside this program, and Output and Status wait for it to end. Process.Arguments gives this program's own.
std/os/process_command.fb
Types
Stdio
enum
Public Enum Stdio
Where a child's stream goes.
std/os/process_command.fb, line 20
-
To this program's own.
-
Through a pipe that this program writes or reads.
-
Nowhere, so its stdin has nothing, and what it writes is dropped.
ProcessOutput
struct
Public Struct ProcessOutput
What a child wrote to its stdout and stderr, and how it ended.
std/os/process_command.fb, line 30
-
How it ended.
-
What it wrote to its stdout.
-
What it wrote to its stderr.
-
Stdout as text, its UTF-8, with U+FFFD for each byte that doesn't start well-formed UTF-8.
-
Stderr as text, as Text is.
Command
class
Public Class Command
A program to start, and what it starts with. It's found as a path, from the Folder it runs in when it's relative, or by its name on the PATH it gets, never in a current folder; on Windows, with .com or .exe after the name too. Its methods give the Command back, so they chain: Command("git").Arg("log").Folder(repo).Output(). It can start the program any number of times.
std/os/process_command.fb, line 59
-
A new ProcessCommand that runs
program, with no arguments yet. -
Adds an argument, which the program gets as it is: nothing splits it, or reads quotes or anything else in it. On Windows, a .bat or .cmd file runs in cmd.exe, which gets one as Rust gives it there, so nothing in it runs: in quotes when it has anything but letters, digits, and #$*+-./:?@_, with each quote doubled, and every % kept from expanding, so the batch file reads it with %~1. One with a line break, which cmd.exe can't take, throws an IOError as it starts.
-
Adds the
arguments, in order, as Arg does. -
Sets the variable
nametovaluefor the program, whose environment is otherwise this program's. On Windows a name is the same in any case, so "Path" is "PATH". -
Takes the variable
nameout of the program's environment. On Windows, the ones every program needs, PATH, SYSTEMROOT, TEMP, and the like, stay, with this program's values. -
Starts the program with no variables but the ones Env sets after this, and on Windows the ones every program needs, as Unset leaves them.
-
Runs the program in
folder, not this program's current one. -
Where its stdin comes from.
-
Where its stdout goes.
-
Where its stderr goes.
-
Starts the program, which runs beside this one, and gives its Child, once what this program printed is out. Its streams are this program's unless Stdin, Stdout, or Stderr said otherwise. Throws an IOError when it can't start, one of NOT_FOUND for a program that isn't there. Panics when a text has a NUL, or a variable's name is empty or has an '=', which none can.
-
Runs the program to its end, and gives what it wrote to its stdout and stderr, and how it ended. Its stdin has nothing, or closes at once when Stdin pipes it. Throws and panics as Spawn does.
-
Output's Async twin, which waits on the main thread instead of blocking it.
-
Runs the program to its end, with this program's streams unless Stdin, Stdout, or Stderr said otherwise, and gives how it ended. Throws and panics as Spawn does.
-
Status's Async twin.
Extends
Process
extend
Extend Process
No doc comment.
std/os/process_command.fb, line 219
-
The program's arguments, after its own name, as what started it gave them. On Windows, they're its command line, split as a C program splits it.
Report an issue with this page or with FutureBlitz on GitHub.