OLD | NEW |
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 /// Helper functionality to make working with IO easier. | 5 /// Helper functionality to make working with IO easier. |
6 library pub.io; | 6 library pub.io; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:collection'; | 9 import 'dart:collection'; |
10 import 'dart:convert'; | 10 import 'dart:convert'; |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 getErrorReason(error) { | 341 getErrorReason(error) { |
342 if (error.osError.errorCode == 5) { | 342 if (error.osError.errorCode == 5) { |
343 return "access was denied"; | 343 return "access was denied"; |
344 } | 344 } |
345 | 345 |
346 if (error.osError.errorCode == 32) { | 346 if (error.osError.errorCode == 32) { |
347 return "it was in use by another process"; | 347 return "it was in use by another process"; |
348 } | 348 } |
349 | 349 |
| 350 if (error.osError.errorCode == 145) { |
| 351 return "of dart-lang/sdk#25353"; |
| 352 } |
| 353 |
350 return null; | 354 return null; |
351 } | 355 } |
352 | 356 |
353 for (var i = 0; i < 2; i++) { | 357 for (var i = 0; i < 2; i++) { |
354 try { | 358 try { |
355 operation(); | 359 operation(); |
356 return; | 360 return; |
357 } on FileSystemException catch (error) { | 361 } on FileSystemException catch (error) { |
358 var reason = getErrorReason(error); | 362 var reason = getErrorReason(error); |
359 if (reason == null) rethrow; | 363 if (reason == null) rethrow; |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 | 1065 |
1062 // TODO(rnystrom): Remove this and change to returning one string. | 1066 // TODO(rnystrom): Remove this and change to returning one string. |
1063 static List<String> _toLines(String output) { | 1067 static List<String> _toLines(String output) { |
1064 var lines = splitLines(output); | 1068 var lines = splitLines(output); |
1065 if (!lines.isEmpty && lines.last == "") lines.removeLast(); | 1069 if (!lines.isEmpty && lines.last == "") lines.removeLast(); |
1066 return lines; | 1070 return lines; |
1067 } | 1071 } |
1068 | 1072 |
1069 bool get success => exitCode == exit_codes.SUCCESS; | 1073 bool get success => exitCode == exit_codes.SUCCESS; |
1070 } | 1074 } |
OLD | NEW |