runCommand function

void runCommand(
  1. String shellCommand
)

Runs a shell command and prints the output from STDERR and STDOUT.

Implementation

void runCommand(String shellCommand) {
  try {
    List<String> shellItems = shellCommand.split(' ');
    String initItem = shellItems[0];
    shellItems.removeAt(0);
    Process.run(initItem, shellItems).then((result) {
      stdout.write(result.stdout);
      stderr.write(result.stderr);
    });
  } catch (e) {
    print(e);
  }
}