fix: forceStop not working when recorded file is executed in loop
This commit is contained in:
@@ -110,6 +110,5 @@ public class RootAutomatorEngine extends ScriptEngine.AbstractScriptEngine<AutoF
|
|||||||
@Override
|
@Override
|
||||||
public synchronized void destroy() {
|
public synchronized void destroy() {
|
||||||
super.destroy();
|
super.destroy();
|
||||||
Log.d(LOG_TAG, "Shell exit");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.stardust.autojs.runtime.api;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.stardust.autojs.runtime.exception.ScriptInterruptedException;
|
||||||
import com.stardust.autojs.util.ProcessUtils;
|
import com.stardust.autojs.util.ProcessUtils;
|
||||||
import com.stardust.pio.UncheckedIOException;
|
import com.stardust.pio.UncheckedIOException;
|
||||||
|
|
||||||
@@ -202,9 +203,7 @@ public class ProcessShell extends AbstractShell {
|
|||||||
commandResult.error = readAll(process.getErrorStream());
|
commandResult.error = readAll(process.getErrorStream());
|
||||||
Log.d(TAG, commandResult.toString());
|
Log.d(TAG, commandResult.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
commandResult.code = -1;
|
throw new ScriptInterruptedException(e);
|
||||||
commandResult.error = e.getMessage();
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (os != null) os.close();
|
if (os != null) os.close();
|
||||||
|
|||||||
@@ -6,6 +6,14 @@ package com.stardust.autojs.runtime.exception;
|
|||||||
|
|
||||||
public class ScriptInterruptedException extends ScriptException {
|
public class ScriptInterruptedException extends ScriptException {
|
||||||
|
|
||||||
|
public ScriptInterruptedException(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScriptInterruptedException(Throwable e) {
|
||||||
|
super(e);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean causedByInterrupted(Throwable e) {
|
public static boolean causedByInterrupted(Throwable e) {
|
||||||
return e instanceof ScriptInterruptedException || e.getCause() instanceof ScriptInterruptedException;
|
return e instanceof ScriptInterruptedException || e.getCause() instanceof ScriptInterruptedException;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user