View | Details | Raw Unified | Return to bug 54128
Collapse All | Expand All

(-)a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java (-1 / +1 lines)
Lines 185-194 public class PumpStreamHandler implements ExecuteStreamHandler { Link Here
185
                return;
185
                return;
186
            }
186
            }
187
187
188
            t.join(JOIN_TIMEOUT);
189
            if (s != null && !s.isFinished()) {
188
            if (s != null && !s.isFinished()) {
190
                s.stop();
189
                s.stop();
191
            }
190
            }
191
            t.join(JOIN_TIMEOUT);
192
            while ((s == null || !s.isFinished()) && t.isAlive()) {
192
            while ((s == null || !s.isFinished()) && t.isAlive()) {
193
                t.interrupt();
193
                t.interrupt();
194
                t.join(JOIN_TIMEOUT);
194
                t.join(JOIN_TIMEOUT);
(-)a/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java (-3 / +18 lines)
Lines 116-122 public class StreamPumper implements Runnable { Link Here
116
            started = true;
116
            started = true;
117
        }
117
        }
118
        finished = false;
118
        finished = false;
119
        finish = false;
120
119
121
        final byte[] buf = new byte[bufferSize];
120
        final byte[] buf = new byte[bufferSize];
122
121
Lines 130-142 public class StreamPumper implements Runnable { Link Here
130
                }
129
                }
131
130
132
                length = is.read(buf);
131
                length = is.read(buf);
133
                if (length <= 0 || finish || Thread.interrupted()) {
132
                if (length <= 0 || Thread.interrupted()) {
134
                    break;
133
                    break;
135
                }
134
                }
136
                os.write(buf, 0, length);
135
                os.write(buf, 0, length);
137
                if (autoflush) {
136
                if (autoflush) {
138
                    os.flush();
137
                    os.flush();
139
                }
138
                }
139
                if (finish) {
140
                	break;
141
                }
142
            }
143
            // On completion, drain any available data (which might be the first data available for quick executions)
144
            if (finish) {
145
                while((length = is.available()) > 0) {
146
                	if (Thread.interrupted()) {
147
                		break;
148
                	}
149
                    length = is.read(buf, 0, Math.min(length, buf.length));
150
                    if (length <= 0) {
151
                        break;
152
                    }
153
                    os.write(buf, 0, length);
154
                }
140
            }
155
            }
141
            os.flush();
156
            os.flush();
142
        } catch (InterruptedException ie) {
157
        } catch (InterruptedException ie) {
Lines 150-155 public class StreamPumper implements Runnable { Link Here
150
                FileUtils.close(os);
165
                FileUtils.close(os);
151
            }
166
            }
152
            finished = true;
167
            finished = true;
168
            finish = false;
153
            synchronized (this) {
169
            synchronized (this) {
154
                notifyAll();
170
                notifyAll();
155
            }
171
            }
156
- 

Return to bug 54128