$ 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.runSync(
platformConfig.executable,
platformConfig.args,
workingDirectory: workingDirectory,
environment: shellConfig.environment,
includeParentEnvironment: shellConfig.includeParentEnvironment,
runInShell: platformConfig.runInshell,
stdoutEncoding: null,
stderrEncoding: null,
);
_processResult = (io.ProcessResult e) {
if (e.exitCode != 0) {
throw ShellException(platformConfig.executable, platformConfig.args,
workingDirectory, e.exitCode, e.pid, e.stdout, e.stderr);
}
return stdoutAsString;
};
}