Skip to content

How to send a command and then get the execution result synchronously #3642

Closed Answered by agnostic-apollo
chenqian-dev asked this question in Q&A
Discussion options

You must be logged in to vote

You can neither directly inject commands into running sessions with RUN_COMMAND or get back results before a session finishes. And for terminal sessions, termux returns the session transcript, and not the stdout or stderr streams separately, and it will contain user inputs as well. Parsing a transcript vs output streams will be different . What you can possibly do is send a bash script to termux that will contain all the commands that need to be executed, like to bash -c.

Another way might be to run a script that waits for a file to be created that contains commands to be executed in the main session, like with a test -f for loop with a sleep+timeout. You can write to the file to send com…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@chenqian-dev
Comment options

@agnostic-apollo
Comment options

Answer selected by agnostic-apollo
@chenqian-dev
Comment options

@agnostic-apollo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants