start function

Future<void> start(
  1. String exec,
  2. List<String> args
)

starting a process to run command

Implementation

Future<void> start(String exec, List<String> args) async {
  Process process = await Process.start(
    exec,
    args,
    runInShell: true,
    mode: ProcessStartMode.inheritStdio,
  );

  ProcessSignal.sigint.watch().listen((event) {
    process.exitCode.then((_) => exit(0));
    process.kill();
  });

  process.exitCode.then((_) {
    exit(0);
  });
}