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

Unified Diff: tests/standalone/io/process_stdout_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
Index: tests/standalone/io/process_stdout_test.dart
diff --git a/tests/standalone/io/process_stdout_test.dart b/tests/standalone/io/process_stdout_test.dart
index ecebe73d0784d47d3d2b538294cd23ce09af651a..048deb3b628605ee895637e4ba7afdc18b63d786 100644
--- a/tests/standalone/io/process_stdout_test.dart
+++ b/tests/standalone/io/process_stdout_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.stdout;
- OutputStream output = process.stdin;
+ InputStream out = process.stdout;
int received = 0;
List<int> buffer = [];
void readData() {
- buffer.addAll(input.read());
+ buffer.addAll(out.read());
for (int i = received;
i < min(data.length, buffer.length) - 1;
i++) {
@@ -43,16 +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.stdin.write(data);
+ process.stdin.close();
+ out.onData = readData;
+ process.stderr.onData = process.stderr.read;
});
}
« no previous file with comments | « tests/standalone/io/process_stderr_test.dart ('k') | tests/standalone/io/process_working_directory_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698