execCommand static method
Implementation
static Future<String> execCommand(
final String command, {
final type = ScriptRunType.shell,
Shell? shell,
String? path,
}) async {
try {
if (type == ScriptRunType.terminal) {
final process = await Process.run(command, [], workingDirectory: path);
debugPrint("Process: $process");
return process.stdout;
} else {
shell ??= Shell();
final String response =
(await shell.run(path != null ? "cd $path; $command" : command))
.outText;
log("ScriptRunner", "Response: $response");
return response;
}
} on ProcessException {
// Toast.show("Script Run failed", message: ex.message.toString());
return "";
}
}