-
Notifications
You must be signed in to change notification settings - Fork 486
Termux integration #997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Termux integration #997
Conversation
@bajrangCoder Could you test this out? |
I will check it , I will notify if any changes will need |
I have tried many times but haven't succeeded, even after making modifications. None of my attempts have been successful; almost every time I try, it fails. Since this solution isn't working, I can't merge it. It needs to work flawlessly on supported devices. Please refine your implementation and also share a test APK for testing. Additionally, why is there a need to ask for permission to run a command in Termux if the user doesn't have Termux installed? I think your pull request is quite tangled. Have you tried building the APK from this PR? Did you succeed? |
Issues with TERMUX.RUN_COMMAND: Requires allow-external-apps=true in ~/.termux/termux.properties. Needs execution permission in settings; some devices don’t show the option, forcing users to use ADB. Termux get frozen in the background, preventing them from receiving the intent. There's no way to confirm if the command ran (PendingIntent could help). On Android 14+, the F-Droid version of Termux can't be installed on some devices. The Play Store version doesn't support run_command. I worked around the freeze issue in Xed-Editor by launching Termux before sending the intent, but this pops open termux shuddenly even when running commands silently potentially confusing the user. |
Added
system.run
andsystem.execute
commands to the system plugin.system.run(Command)
: Promise: It runs the command then returns a PtyResponse or throws a PtyErrorsystem.execute(Command)
: Promise: It runs the command but dosen’t wait for the output or any error thrown.Added
pty
module and export toacode
The
pty.host.run
function takes theRunCommand
type as argumentExample Usage
System Run
Read this (TERMUX.RUN_COMMAND) for more info on
sessionAction
and other argumentsUsing Acode PTY
You should use this for spawning and interacting with processes
Type Interface
Command
command
: String: Represent the command to be executedargs
: Array: Arguments to be passed to the commandbackground
: Boolean: Specify whether to run the command in the background as a taskhomeDir
: String: Path where the command should be executed fromPtyResponse
stderr
: Stringstdout
: StringexitCode
: NumberstderrLength
: NumberstdoutLength
: NumberPtyError
error
: StringerrorCode
: NumberexitCode
: NumberRunCommand
command
: String: Represent the command to be executedtype
: String: Specify connection type, should be eitherpty
(pseudo terminal mode) orprocess
(simply execute the command and relay putputs)args
: Array: Arguments to be passed to the commandonmessage
: Function(data): void : Specify function to be called when a message comes throughautoReconnect
: Boolean: Auto reconnect to server in case of disconnection?reconnectDelay
: Number: How long to wait before attempting to reconnectmaxRetries
: Number: How many times to try to reconnect before giving up