mirror of
https://github.com/flutter/packages.git
synced 2025-06-04 02:08:40 +08:00
[flutter_plugin_tools] Use -version with java (#4171)
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
## NEXT
|
||||
## 0.4.1
|
||||
|
||||
- Improved `license-check` output.
|
||||
- Use `java -version` rather than `java --version`, for compatibility with more
|
||||
versions of Java.
|
||||
|
||||
## 0.4.0
|
||||
|
||||
|
@ -244,9 +244,12 @@ class FormatCommand extends PluginCommand {
|
||||
|
||||
/// Returns true if [command] can be run successfully.
|
||||
Future<bool> _hasDependency(String command) async {
|
||||
// Some versions of Java accept both -version and --version, but some only
|
||||
// accept -version.
|
||||
final String versionFlag = command == 'java' ? '-version' : '--version';
|
||||
try {
|
||||
final io.ProcessResult result =
|
||||
await processRunner.run(command, <String>['--version']);
|
||||
await processRunner.run(command, <String>[versionFlag]);
|
||||
if (result.exitCode != 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: flutter_plugin_tools
|
||||
description: Productivity utils for flutter/plugins and flutter/packages
|
||||
repository: https://github.com/flutter/plugins/tree/master/script/tool
|
||||
version: 0.4.0
|
||||
version: 0.4.1
|
||||
|
||||
dependencies:
|
||||
args: ^2.1.0
|
||||
|
@ -146,7 +146,7 @@ void main() {
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
const ProcessCall('java', <String>['--version'], null),
|
||||
const ProcessCall('java', <String>['-version'], null),
|
||||
ProcessCall(
|
||||
'java',
|
||||
<String>[
|
||||
|
Reference in New Issue
Block a user