$ constructor
$(
- String cmd, [
- ShellConfig shellConfig = const base.ShellConfig()
Implementation
$(String cmd, [base.ShellConfig shellConfig = const base.ShellConfig()]) {
final workingDirectory =
shellConfig.workingDirectory ?? io.Directory.current.path;
final platformConfig = createPlatformExecutableAndArgs(cmd);
_rawResult = io.Process.run(
platformConfig.executable,
platformConfig.args,
workingDirectory: workingDirectory,
environment: shellConfig.environment,
includeParentEnvironment: shellConfig.includeParentEnvironment,
runInShell: platformConfig.runInshell,
stdoutEncoding: null,
stderrEncoding: null,
);
_processResult = (io.ProcessResult e) async {
if (e.exitCode != 0) {
throw ShellException(platformConfig.executable, platformConfig.args,
workingDirectory, e.exitCode, e.pid, e.stdout, e.stderr);
}
return stdoutAsString;
};
}