@@ -89,8 +89,6 @@ class CommandLineOptions {
8989
9090@visibleForTesting
9191class DependencyChecker {
92- static final _pubName = Platform .isWindows ? 'pub.bat' : 'pub' ;
93-
9492 /// The directory which contains the package being migrated.
9593 final String _directory;
9694 final Context _pathContext;
@@ -101,16 +99,15 @@ class DependencyChecker {
10199 this ._directory, this ._pathContext, this ._logger, this ._processManager);
102100
103101 bool check () {
104- var pubPath = _pathContext.join (getSdkPath (), 'bin' , _pubName);
105- var result = _processManager.runSync (
106- pubPath, ['outdated' , '--mode=null-safety' , '--json' ],
107- workingDirectory: _directory);
108-
102+ var pubPath = _pathContext.join (getSdkPath (), 'bin' , 'dart' );
103+ var pubArguments = ['pub' , 'outdated' , '--mode=null-safety' , '--json' ];
109104 var preNullSafetyPackages = < String , String > {};
110105 try {
106+ var result = _processManager.runSync (pubPath, pubArguments,
107+ workingDirectory: _directory);
111108 if ((result.stderr as String ).isNotEmpty) {
112109 throw FormatException (
113- '`pub outdated --mode=null-safety` exited with exit code '
110+ '`dart pub outdated --mode=null-safety` exited with exit code '
114111 '${result .exitCode } and stderr:\n\n ${result .stderr }' );
115112 }
116113 var outdatedOutput = jsonDecode (result.stdout as String );
@@ -139,6 +136,12 @@ class DependencyChecker {
139136 var version = json.expectType <String >(current['version' ], 'version' );
140137 preNullSafetyPackages[name] = version;
141138 }
139+ } on ProcessException catch (e) {
140+ _logger.stderr (
141+ 'Warning: Could not execute `$pubPath ${pubArguments .join (' ' )}`: '
142+ '"${e .message }"' );
143+ // Allow the program to continue; users should be allowed to attempt to
144+ // migrate when `pub outdated` is misbehaving, or if there is a bug above.
142145 } on FormatException catch (e) {
143146 _logger.stderr ('Warning: ${e .message }' );
144147 // Allow the program to continue; users should be allowed to attempt to
@@ -156,7 +159,7 @@ class DependencyChecker {
156159 }
157160 _logger.stderr ('' );
158161 _logger.stderr ('It is highly recommended to upgrade all dependencies to '
159- 'versions which have migrated. Use `$ _pubName outdated '
162+ 'versions which have migrated. Use `dart pub outdated '
160163 '--mode=null-safety` to check the status of dependencies.' );
161164 _logger.stderr ('' );
162165 _logger.stderr ('Visit https://dart.dev/tools/pub/cmd/pub-outdated for '
0 commit comments