Shell constructor
Shell({
- bool throwOnError = true,
- String? workingDirectory,
- Map<
String, String> ? environment, - bool includeParentEnvironment = true,
- bool? runInShell,
- Encoding stdoutEncoding = systemEncoding,
- Encoding stderrEncoding = systemEncoding,
- Stream<
List< ? stdin,int> > - StreamSink<
List< ? stdout,int> > - StreamSink<
List< ? stderr,int> > - bool verbose = true,
- bool? commandVerbose,
- bool? commentVerbose,
- ShellOptions? options,
throwOnError means that if an exit code is not 0, it will throw an error
Unless specified runInShell will be false. However on windows, it will
default to true for non .exe files
if verbose is not false or commentVerbose is true, it will display the
comments as well
options overrides all other parameters
Implementation
factory Shell({
bool throwOnError = true,
String? workingDirectory,
Map<String, String>? environment,
bool includeParentEnvironment = true,
bool? runInShell,
Encoding stdoutEncoding = systemEncoding,
Encoding stderrEncoding = systemEncoding,
Stream<List<int>>? stdin,
StreamSink<List<int>>? stdout,
StreamSink<List<int>>? stderr,
bool verbose = true,
// Default to true
bool? commandVerbose,
// Default to false
bool? commentVerbose,
/// Overrides all parameters
ShellOptions? options,
}) {
var shell = shellContext.newShell(
options:
options ??
ShellOptions(
verbose: verbose,
stdin: stdin,
stdout: stdout,
stderr: stderr,
throwOnError: throwOnError,
workingDirectory: workingDirectory,
runInShell: runInShell,
commandVerbose: commandVerbose ?? verbose,
environment: environment,
includeParentEnvironment: includeParentEnvironment,
commentVerbose: commentVerbose ?? false,
stderrEncoding: stderrEncoding,
stdoutEncoding: stdoutEncoding,
),
);
return shell;
}