Struct term_transcript::ShellOptions [−][src]
pub struct ShellOptions<Cmd = Command> { /* fields omitted */ }
Expand description
Options for executing commands in the shell. Used in Transcript::from_inputs()
and in TestConfig
.
The type param maps to extensions available for the shell. For example, StdShell
extension allows to specify custom aliases for the executed commands.
Implementations
Changes the current directory of the command.
Sets the I/O timeout for shell commands. This determines how long methods like
Transcript::from_inputs()
wait
for output of a command before proceeding to the next command. Longer values
allow to capture output more accurately, but result in longer execution.
By default, the I/O timeout is 1 second.
Sets an additional initialization timeout (relative to the one set by
Self::with_io_timeout()
) before reading the output of the first command.
By default, the initialization timeout is zero.
Adds an initialization command. Such commands are sent to the shell before executing any user input. The corresponding output from the shell is not captured.
Sets the value
of an environment variable with the specified name
.
Sets the line mapper for the shell. This allows to filter and/or map terminal outputs.
Adds paths to cargo binaries (including examples) to the PATH
env variable
for the shell described by these options.
This allows to call them by the corresponding filename, without specifying a path
or doing complex preparations (e.g., calling cargo install
).
Limitations
- The caller must be a unit or integration test; the method will work improperly otherwise.
Adds a specified path to the PATH
env variable for the shell described by these options.
This method can be called multiple times to add multiple paths and is composable
with Self::with_cargo_path()
.
Creates options for PowerShell.
Creates an alias for the binary at path_to_bin
, which should be an absolute path.
This allows to call the binary using this alias without complex preparations (such as
installing it globally via cargo install
), and is more flexible than
Self::with_cargo_path()
.
In integration tests, you may use env!("CARGO_BIN_EXE_<name>")
to get a path
to binary targets.
Limitations
- For Bash and PowerShell,
name
must be a valid name of a function. Forsh
,name
must be a valid name for thealias
command. Thename
validity is not checked.