Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: pkg/analyzer/lib/source/pub_package_map_provider.dart

Issue 750113003: null check for pub result in PubPackageMapProvider (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library source.pub_package_map_provider; 5 library source.pub_package_map_provider;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io' as io; 9 import 'dart:io' as io;
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 try { 49 try {
50 result = io.Process.runSync( 50 result = io.Process.runSync(
51 executable, 51 executable,
52 [PUB_LIST_COMMAND], 52 [PUB_LIST_COMMAND],
53 workingDirectory: folder.path); 53 workingDirectory: folder.path);
54 } on io.ProcessException catch (exception, stackTrace) { 54 } on io.ProcessException catch (exception, stackTrace) {
55 AnalysisEngine.instance.logger.logInformation( 55 AnalysisEngine.instance.logger.logInformation(
56 "Error running pub $PUB_LIST_COMMAND\n$exception\n$stackTrace"); 56 "Error running pub $PUB_LIST_COMMAND\n$exception\n$stackTrace");
57 } 57 }
58 if (result == null || result.exitCode != 0) { 58 if (result == null || result.exitCode != 0) {
59 String exitCode =
60 result != null ? 'exit code ${result.exitCode}' : 'null';
59 AnalysisEngine.instance.logger.logInformation( 61 AnalysisEngine.instance.logger.logInformation(
60 "pub $PUB_LIST_COMMAND failed: exit code ${result.exitCode}"); 62 "pub $PUB_LIST_COMMAND failed: $exitCode");
61 return _error(folder); 63 return _error(folder);
62 } 64 }
63 try { 65 try {
64 return parsePackageMap(result.stdout, folder); 66 return parsePackageMap(result.stdout, folder);
65 } catch (exception, stackTrace) { 67 } catch (exception, stackTrace) {
66 AnalysisEngine.instance.logger.logError( 68 AnalysisEngine.instance.logger.logError(
67 "Malformed output from pub $PUB_LIST_COMMAND\n$exception\n$stackTrace" ); 69 "Malformed output from pub $PUB_LIST_COMMAND\n$exception\n$stackTrace" );
68 } 70 }
69 71
70 return _error(folder); 72 return _error(folder);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 */ 129 */
128 PackageMapInfo _error(Folder folder) { 130 PackageMapInfo _error(Folder folder) {
129 // Even if an error occurs, we still need to know the dependencies, so that 131 // Even if an error occurs, we still need to know the dependencies, so that
130 // we'll know when to try running "pub list-package-dirs" again. 132 // we'll know when to try running "pub list-package-dirs" again.
131 // Unfortunately, "pub list-package-dirs" doesn't tell us dependencies when 133 // Unfortunately, "pub list-package-dirs" doesn't tell us dependencies when
132 // an error occurs, so just assume there is one dependency, "pubspec.lock". 134 // an error occurs, so just assume there is one dependency, "pubspec.lock".
133 List<String> dependencies = <String>[join(folder.path, PUBSPEC_LOCK_NAME)]; 135 List<String> dependencies = <String>[join(folder.path, PUBSPEC_LOCK_NAME)];
134 return new PackageMapInfo(null, dependencies.toSet()); 136 return new PackageMapInfo(null, dependencies.toSet());
135 } 137 }
136 } 138 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698