Add support for stdin for background TermuxTasks

This will allow passing scripts (to bash or python) or other data to an executable via stdin. Arguments are passed to the executable and not the script.
This commit is contained in:
agnostic-apollo
2021-04-12 18:25:43 +05:00
parent 824b3e657f
commit 192b208883
5 changed files with 70 additions and 18 deletions

View File

@@ -74,6 +74,8 @@ public class ExecutionCommand {
public Uri executableUri;
/** The executable arguments array for the {@link ExecutionCommand}. */
public String[] arguments;
/** The stdin string for the {@link ExecutionCommand}. */
public String stdin;
/** The current working directory for the {@link ExecutionCommand}. */
public String workingDirectory;
@@ -138,10 +140,11 @@ public class ExecutionCommand {
this.id = id;
}
public ExecutionCommand(Integer id, String executable, String[] arguments, String workingDirectory, boolean inBackground, boolean isFailsafe) {
public ExecutionCommand(Integer id, String executable, String[] arguments, String stdin, String workingDirectory, boolean inBackground, boolean isFailsafe) {
this.id = id;
this.executable = executable;
this.arguments = arguments;
this.stdin = stdin;
this.workingDirectory = workingDirectory;
this.inBackground = inBackground;
this.isFailsafe = isFailsafe;
@@ -560,4 +563,8 @@ public class ExecutionCommand {
return currentState == ExecutionState.EXECUTING;
}
public synchronized boolean isSuccessful() {
return currentState == ExecutionState.SUCCESS;
}
}