diff options
author | Sorin Basca <sorinbasca@google.com> | 2024-02-21 11:17:27 +0000 |
---|---|---|
committer | Sorin Basca <sorinbasca@google.com> | 2024-02-28 11:07:08 +0000 |
commit | b2502802c4b488efe62bd0e8eba0a3d6cc4bdd50 (patch) | |
tree | b5d896716579f774f701defa6118131093a04899 | |
parent | 4d651d99278a2236e8e2efdcd6de6408c62f6f51 (diff) | |
download | vogar-b2502802c4b488efe62bd0e8eba0a3d6cc4bdd50.tar.gz |
Handle stream closed when task process exits
Fixes: 308917607
Test: art/tools/run-libcore-tests.sh --mode=host --gcstress
Change-Id: Iac16e028d6fc1f247948357c5f686bbf2cb25b91
-rw-r--r-- | src/vogar/monitor/InterleavedReader.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/vogar/monitor/InterleavedReader.java b/src/vogar/monitor/InterleavedReader.java index 2f9f15a..a97ba56 100644 --- a/src/vogar/monitor/InterleavedReader.java +++ b/src/vogar/monitor/InterleavedReader.java @@ -78,7 +78,15 @@ public final class InterleavedReader implements Closeable { int textEnd; while (true) { - int r = reader.read(buffer, count, buffer.length - count); + int r = -1; + + try { + r = reader.read(buffer, count, buffer.length - count); + } catch (IOException e) { + // When running under gcstress, the output stream may be closed outside our control when + // the target process exits. In order to allow this, catch the stream closed exception and + // return whatever has been buffered already. (b/308917607) + } if (r == -1) { // the input is exhausted; return the remaining characters |