Skip to content

Commit

Permalink
Merge pull request #2092 from DrBu7cher/fix-compatibility-checker-stuck
Browse files Browse the repository at this point in the history
[patrol_cli] fix(compatibility_checker.dart): it get's stuck when it can't find patrol
  • Loading branch information
piotruela authored Feb 5, 2024
2 parents 66cc1c0 + 5208f70 commit a5c57d3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
4 changes: 4 additions & 0 deletions packages/patrol_cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.6.4

- Fix compatibility_checker getting stuck (#2091).

## 2.6.3

- Fix invalid JSON output of version check command (#2087).
Expand Down
2 changes: 1 addition & 1 deletion packages/patrol_cli/lib/src/base/constants.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/// Version of Patrol CLI. Must be kept in sync with pubspec.yaml.
/// If you update this, make sure that compatibility-table.mdx is updated (if needed)
const version = '2.6.3';
const version = '2.6.4';
29 changes: 16 additions & 13 deletions packages/patrol_cli/lib/src/compatibility_checker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,27 @@ class CompatibilityChecker {
)
..disposedBy(scope);

process.listenStdOut((line) async {
if (line.startsWith('- patrol ')) {
packageCompleter.complete(line.split(' ').last);
}
}).disposedBy(scope);
process.listenStdOut(
(line) async {
if (line.startsWith('- patrol ')) {
packageCompleter.complete(line.split(' ').last);
}
},
onDone: () {
if (!packageCompleter.isCompleted) {
throwToolExit(
'Failed to read patrol version. Make sure you have patrol '
'dependency in your pubspec.yaml file',
);
}
},
).disposedBy(scope);
});

packageVersion = await packageCompleter.future;

if (packageVersion == null) {
throwToolExit(
'Failed to read patrol version. Make sure you have patrol '
'dependency in your pubspec.yaml file',
);
}

final cliVersion = Version.parse(constants.version);
final patrolVersion = Version.parse(packageVersion);
final patrolVersion = Version.parse(packageVersion!);

final isCompatible = cliVersion.isCompatibleWith(patrolVersion);

Expand Down
2 changes: 1 addition & 1 deletion packages/patrol_cli/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: patrol_cli
description: >
Command-line tool for Patrol, a powerful Flutter-native UI testing framework.
version: 2.6.3 # Must be kept in sync with constants.dart
version: 2.6.4 # Must be kept in sync with constants.dart
homepage: https://patrol.leancode.co
repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol_cli
issue_tracker: https://github.com/leancodepl/patrol/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+patrol_cli%22
Expand Down

0 comments on commit a5c57d3

Please sign in to comment.