executeResult method

Future<List<String>> executeResult(
  1. String command,
  2. List<String> arguments
)

Executes an external command and returns the output lines.

command the external command, e.g. "apt-get" arguments the program arguments, e.g. 'show', 'my-package'

Implementation

Future<List<String>> executeResult(
    String command, List<String> arguments) async {
  var rc = <String>[];
  var result = await Process.run(command, arguments);
  final data = result.stdout;
  if (data is String) {
    rc = data.split('\n');
  } else {
    rc = data;
  }
  return rc;
}