Skip to content

Commit ea599bd

Browse files
committed
修复RxJava取消订阅后,线程仍在继续执行,导致的崩溃
1 parent 5bb9eca commit ea599bd

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

AndroidExecLibrary/src/main/java/com/excellence/exec/CommandTask.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void accept(Long aLong) throws Exception {
172172
BufferedReader stdin = new BufferedReader(new InputStreamReader(mProcess.getInputStream()));
173173
StringBuilder result = new StringBuilder();
174174
String line = null;
175-
while (mStatus == STATUS_RUNNING && (line = stdin.readLine()) != null) {
175+
while ((line = stdin.readLine()) != null) {
176176
if (mStatus == STATUS_RUNNING) {
177177
restartTimer();
178178
mIListener.onProgress(line);
@@ -222,9 +222,6 @@ private void killProcess() {
222222
// close stream
223223
mProcess.destroy();
224224
}
225-
if (mCommandTask != null && !mCommandTask.isDisposed()) {
226-
mCommandTask.dispose();
227-
}
228225
}
229226

230227
protected void cancel() {

0 commit comments

Comments
 (0)