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

Unified Diff: utils/pub/io.dart

Issue 11174003: Use correct newline-token on windows, in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use a more generic approach. Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/io.dart
diff --git a/utils/pub/io.dart b/utils/pub/io.dart
index 384cc08b8a3994f16f0f83eeda8def56670a4dc8..6981e28aa68245855e84f22ef564086a0bfaedaa 100644
--- a/utils/pub/io.dart
+++ b/utils/pub/io.dart
@@ -21,6 +21,8 @@ String _gitCommandCache;
/** Gets the current working directory. */
String get workingDir => new File('.').fullPathSync();
+const Pattern NEWLINE_PATTERN = const RegExp("\r\n?|\n\r?");
+
/**
* Prints the given string to `stderr` on its own line.
*/
@@ -503,7 +505,7 @@ Future<PubProcessResult> runProcess(String executable, List<String> args,
return future.transform((result) {
// TODO(rnystrom): Remove this and change to returning one string.
List<String> toLines(String output) {
- var lines = output.split("\n");
+ var lines = output.split(NEWLINE_PATTERN);
if (!lines.isEmpty() && lines.last() == "") lines.removeLast();
return lines;
}
« 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