How to send a command and then get the execution result synchronously #3642
-
How to send a command and then get the execution result synchronously. For example, proot-distro login debian, how to get the login result from the Android layer? Because I need to wait for success and then perform some operations on the android layer. |
Beta Was this translation helpful? Give feedback.
Answered by
agnostic-apollo
Oct 13, 2023
Replies: 1 comment 4 replies
-
Send command from where and receive result where? You probably need https://github.com/termux/termux-app/wiki/RUN_COMMAND-Intent if a separate android app. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 abash
script to termux that will contain all the commands that need to be executed, like tobash -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…