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
|
||||
public synchronized void destroy() {
|
||||
super.destroy();
|
||||
Log.d(LOG_TAG, "Shell exit");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.stardust.autojs.runtime.api;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.stardust.autojs.runtime.exception.ScriptInterruptedException;
|
||||
import com.stardust.autojs.util.ProcessUtils;
|
||||
import com.stardust.pio.UncheckedIOException;
|
||||
|
||||
@@ -202,9 +203,7 @@ public class ProcessShell extends AbstractShell {
|
||||
commandResult.error = readAll(process.getErrorStream());
|
||||
Log.d(TAG, commandResult.toString());
|
||||
} catch (Exception e) {
|
||||
commandResult.code = -1;
|
||||
commandResult.error = e.getMessage();
|
||||
e.printStackTrace();
|
||||
throw new ScriptInterruptedException(e);
|
||||
} finally {
|
||||
try {
|
||||
if (os != null) os.close();
|
||||
|
||||
@@ -6,6 +6,14 @@ package com.stardust.autojs.runtime.exception;
|
||||
|
||||
public class ScriptInterruptedException extends ScriptException {
|
||||
|
||||
public ScriptInterruptedException(){
|
||||
|
||||
}
|
||||
|
||||
public ScriptInterruptedException(Throwable e) {
|
||||
super(e);
|
||||
}
|
||||
|
||||
public static boolean causedByInterrupted(Throwable e) {
|
||||
return e instanceof ScriptInterruptedException || e.getCause() instanceof ScriptInterruptedException;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user