waitForExit method
Waits for the process to exit and returns the exit code.
If the process was run as administrator on Windows, this method implements a custom waiting mechanism using a validation file.
Throws an Exception if the process is not managed.
Implementation
Future<int> waitForExit() async {
if (!isManaged) {
throw Exception("Process isn't managed by ProcessInterface.");
}
if (options!.runAsAdministrator && Platform.isWindows) {
await _waitForPowershell();
}
return _process.exitCode;
}