tryProcessRunSync function
        
ProcessResult?
tryProcessRunSync(
    
- String executable,
- List<String> args, {
- String? workingDirectory,
- Map<String, String> ? environment,
- bool includeParentEnvironment = true,
- bool runInShell = false,
- Encoding? stdoutEncoding = systemEncoding,
- Encoding? stderrEncoding = systemEncoding,
- void onProcessException(- ProcessException exception,
- StackTrace stackTrace
 
Tries to synchronously run the executable with the provided args.
Returns null if Process.runSync throws a ProcessException.
Implementation
ProcessResult? tryProcessRunSync(
  String executable,
  List<String> args, {
  String? workingDirectory,
  Map<String, String>? environment,
  bool includeParentEnvironment = true,
  bool runInShell = false,
  Encoding? stdoutEncoding = systemEncoding,
  Encoding? stderrEncoding = systemEncoding,
  void Function(
    ProcessException exception,
    StackTrace stackTrace,
  )? onProcessException,
}) {
  try {
    return Process.runSync(
      executable,
      args,
      workingDirectory: workingDirectory,
      environment: environment,
      includeParentEnvironment: includeParentEnvironment,
      runInShell: runInShell,
      stdoutEncoding: stdoutEncoding,
      stderrEncoding: stderrEncoding,
    );
  } on ProcessException catch (exp, st) {
    onProcessException?.call(exp, st);
    return null;
  }
}