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

Unified Diff: tests/standalone/io/process_stderr_test.dart

Issue 11343009: Get rid of 'close' on process. It is very easy to use incorrectly and cut off data from your stream… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. 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 | « tests/standalone/io/process_segfault_test.dart ('k') | tests/standalone/io/process_stdout_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/process_stderr_test.dart
diff --git a/tests/standalone/io/process_stderr_test.dart b/tests/standalone/io/process_stderr_test.dart
index 8cd987fa0f7fb10734cd72e914b9bb70e9771026..ccf31877322de299bd2957caf57a398eebda3374 100644
--- a/tests/standalone/io/process_stderr_test.dart
+++ b/tests/standalone/io/process_stderr_test.dart
@@ -23,14 +23,13 @@ void test(Future<Process> future, int expectedExitCode) {
List<int> data = "ABCDEFGHI\n".charCodes;
final int dataSize = data.length;
- InputStream input = process.stderr;
- OutputStream output = process.stdin;
+ InputStream err = process.stderr;
int received = 0;
List<int> buffer = [];
void readData() {
- buffer.addAll(input.read());
+ buffer.addAll(err.read());
for (int i = received;
i < min(data.length, buffer.length) - 1;
i++) {
@@ -43,17 +42,14 @@ void test(Future<Process> future, int expectedExitCode) {
Expect.equals(13, buffer[dataSize - 1]);
Expect.equals(10, buffer[dataSize]);
buffer.removeLast();
- process.close();
- } else if (received === dataSize) {
- process.close();
}
}
}
- output.write(data);
- output.close();
- input.onData = readData;
-
+ process.stdout.onData = process.stdout.read;
+ process.stdin.write(data);
+ process.stdin.close();
+ err.onData = readData;
});
}
« no previous file with comments | « tests/standalone/io/process_segfault_test.dart ('k') | tests/standalone/io/process_stdout_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698