runScript method
Future<CommandResult>
runScript(
- String script, {
- required bool showOutput,
- FilterType? filterType,
override
filterType
is the type of filter to apply to the output
Implementation
@override
Future<CommandResult> runScript(
String script, {
required bool showOutput,
FilterType? filterType,
}) async {
final port = ReceivePort();
final isolate = await Isolate.spawn(
_runScript,
port.sendPort,
);
final completer = Completer<CommandResult>();
await for (final event in port) {
if (event is SendPort) {
event.send({
'script': script,
'showOutput': showOutput,
'filterType': filterType?.name,
'loggerLevel': logger.level.name,
});
} else if (event is Map) {
final result = CommandResult.fromJson(event);
completer.complete(result);
break;
}
}
await completer.future;
isolate.kill();
return completer.future;
}