From 29d05cc72c44b42df783b252eb3488b7f4d38c4e Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sat, 11 Jun 2022 19:25:45 +0500 Subject: [PATCH] Changed: All `ExecutionCommands` not managed by `TermuxShellManager` should have `id` `-1` --- .../com/termux/shared/shell/command/ExecutionCommand.java | 3 ++- .../src/main/java/com/termux/shared/termux/TermuxUtils.java | 4 ++-- .../java/com/termux/shared/termux/file/TermuxFileUtils.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/termux-shared/src/main/java/com/termux/shared/shell/command/ExecutionCommand.java b/termux-shared/src/main/java/com/termux/shared/shell/command/ExecutionCommand.java index 7876ddac..d68c628c 100644 --- a/termux-shared/src/main/java/com/termux/shared/shell/command/ExecutionCommand.java +++ b/termux-shared/src/main/java/com/termux/shared/shell/command/ExecutionCommand.java @@ -140,7 +140,8 @@ public class ExecutionCommand { } - /** The optional unique id for the {@link ExecutionCommand}. */ + /** The optional unique id for the {@link ExecutionCommand}. This should equal -1 if execution + * command is not going to be managed by a shell manager. */ public Integer id; /** The process id of command. */ diff --git a/termux-shared/src/main/java/com/termux/shared/termux/TermuxUtils.java b/termux-shared/src/main/java/com/termux/shared/termux/TermuxUtils.java index 0d66a3f5..4104fe5b 100644 --- a/termux-shared/src/main/java/com/termux/shared/termux/TermuxUtils.java +++ b/termux-shared/src/main/java/com/termux/shared/termux/TermuxUtils.java @@ -592,7 +592,7 @@ public class TermuxUtils { aptInfoScript = aptInfoScript.replaceAll(Pattern.quote("@TERMUX_PREFIX@"), TermuxConstants.TERMUX_PREFIX_DIR_PATH); - ExecutionCommand executionCommand = new ExecutionCommand(1, + ExecutionCommand executionCommand = new ExecutionCommand(-1, TermuxConstants.TERMUX_BIN_PREFIX_DIR_PATH + "/bash", null, aptInfoScript, null, ExecutionCommand.Runner.APP_SHELL.getName(), false); executionCommand.commandLabel = "APT Info Command"; @@ -652,7 +652,7 @@ public class TermuxUtils { // Run script // Logging must be disabled for output of logcat command itself in StreamGobbler - ExecutionCommand executionCommand = new ExecutionCommand(1, "/system/bin/sh", + ExecutionCommand executionCommand = new ExecutionCommand(-1, "/system/bin/sh", null, logcatScript + "\n", "/", ExecutionCommand.Runner.APP_SHELL.getName(), true); executionCommand.commandLabel = "Logcat dump command"; executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_OFF; diff --git a/termux-shared/src/main/java/com/termux/shared/termux/file/TermuxFileUtils.java b/termux-shared/src/main/java/com/termux/shared/termux/file/TermuxFileUtils.java index 6172a412..2f73c689 100644 --- a/termux-shared/src/main/java/com/termux/shared/termux/file/TermuxFileUtils.java +++ b/termux-shared/src/main/java/com/termux/shared/termux/file/TermuxFileUtils.java @@ -360,7 +360,7 @@ public class TermuxFileUtils { .append("/system/bin/grep -E '( /data )|( /data/data )|( /data/user/[0-9]+ )' /proc/self/mountinfo 2>&1 | /system/bin/grep -v '/data_mirror' 2>&1"); // Run script - ExecutionCommand executionCommand = new ExecutionCommand(1, "/system/bin/sh", null, + ExecutionCommand executionCommand = new ExecutionCommand(-1, "/system/bin/sh", null, statScript.toString() + "\n", "/", ExecutionCommand.Runner.APP_SHELL.getName(), true); executionCommand.commandLabel = TermuxConstants.TERMUX_APP_NAME + " Files Stat Command"; executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_OFF;