getVersionSync method

  1. @override
Version getVersionSync()
override

Returns the version of executable.

Implementation

@override
Version getVersionSync() {
  // chmod (GNU coreutils) 9.1
  // Copyright (C) 2022 Free Software Foundation, Inc.
  // License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
  // This is free software: you are free to change and redistribute it.
  // There is NO WARRANTY, to the extent permitted by law.
  //
  // Written by David MacKenzie and Jim Meyering.

  final versionStr =
      runSync(["--version"]).stdout.toString().trim().split("\n").first;
  final regex = RegExp(r"\d+\.\d+");
  return Version.parse(regex.stringMatch(versionStr)!);
}