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

Side by Side Diff: sdk/lib/_internal/pub/bin/pub.dart

Issue 216603010: Rip out dart:io from pkg/http wherever possible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 8 months 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 | « pkg/oauth2/pubspec.yaml ('k') | sdk/lib/_internal/pub/lib/src/utils.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:io'; 6 import 'dart:io';
7 7
8 import 'package:args/args.dart'; 8 import 'package:args/args.dart';
9 import 'package:http/http.dart' as http;
9 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
10 import 'package:stack_trace/stack_trace.dart'; 11 import 'package:stack_trace/stack_trace.dart';
11 12
12 import '../lib/src/command.dart'; 13 import '../lib/src/command.dart';
13 import '../lib/src/exit_codes.dart' as exit_codes; 14 import '../lib/src/exit_codes.dart' as exit_codes;
14 import '../lib/src/http.dart'; 15 import '../lib/src/http.dart';
15 import '../lib/src/io.dart'; 16 import '../lib/src/io.dart';
16 import '../lib/src/log.dart' as log; 17 import '../lib/src/log.dart' as log;
17 import '../lib/src/sdk.dart' as sdk; 18 import '../lib/src/sdk.dart' as sdk;
18 import '../lib/src/utils.dart'; 19 import '../lib/src/utils.dart';
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 }).then((_) { 130 }).then((_) {
130 // Explicitly exit on success to ensure that any dangling dart:io handles 131 // Explicitly exit on success to ensure that any dangling dart:io handles
131 // don't cause the process to never terminate. 132 // don't cause the process to never terminate.
132 return flushThenExit(exit_codes.SUCCESS); 133 return flushThenExit(exit_codes.SUCCESS);
133 }); 134 });
134 } 135 }
135 136
136 /// Returns the appropriate exit code for [exception], falling back on 1 if no 137 /// Returns the appropriate exit code for [exception], falling back on 1 if no
137 /// appropriate exit code could be found. 138 /// appropriate exit code could be found.
138 int chooseExitCode(exception) { 139 int chooseExitCode(exception) {
139 if (exception is HttpException || exception is HttpException || 140 if (exception is HttpException || exception is http.ClientException ||
140 exception is SocketException || exception is PubHttpException) { 141 exception is SocketException || exception is PubHttpException) {
141 return exit_codes.UNAVAILABLE; 142 return exit_codes.UNAVAILABLE;
142 } else if (exception is FormatException || exception is DataException) { 143 } else if (exception is FormatException || exception is DataException) {
143 return exit_codes.DATA; 144 return exit_codes.DATA;
144 } else if (exception is UsageException) { 145 } else if (exception is UsageException) {
145 return exit_codes.USAGE; 146 return exit_codes.USAGE;
146 } else { 147 } else {
147 return 1; 148 return 1;
148 } 149 }
149 } 150 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (Platform.operatingSystem != 'windows') return null; 209 if (Platform.operatingSystem != 'windows') return null;
209 210
210 return runProcess('ver', []).then((result) { 211 return runProcess('ver', []).then((result) {
211 if (result.stdout.join('\n').contains('XP')) { 212 if (result.stdout.join('\n').contains('XP')) {
212 log.error('Sorry, but pub is not supported on Windows XP.'); 213 log.error('Sorry, but pub is not supported on Windows XP.');
213 return flushThenExit(exit_codes.USAGE); 214 return flushThenExit(exit_codes.USAGE);
214 } 215 }
215 }); 216 });
216 }); 217 });
217 } 218 }
OLDNEW
« no previous file with comments | « pkg/oauth2/pubspec.yaml ('k') | sdk/lib/_internal/pub/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698