Run Nix package manager on Android. Based off Termux the terminal emulator, but not Termux the distro. [maintainer=@t184256]
Find a file
agnostic-apollo a2209ddd5e Add support for sending back background and foreground command results for RUN_COMMAND intent and foreground command results for Termux:Tasker
Previously, termux only supported getting result of BACKGROUND commands back if they were started via Termux:Tasker plugin. Getting back result of foreground commands was not possible with any way.

Now with RUN_COMMAND intent or Termux:Tasker, the third party apps and users can get the foreground command results as well. Note that by "foreground results" we only mean the session transcript. The session transcript will contain both stdout and stderr combined, basically anything sent to the the pseudo terminal /dev/pts, including PS1 prefixes for interactive sessions. Getting separate stdout and stderr can currently only be done with background commands.

Moreover, with RUN_COMMAND intent, third party apps and users can get the background commands results as well. This means separate extras for stdout and stderr.

The exit code will also be returned for either case.

### RUN_COMMAND intent

The result extras are returned in the TERMUX_SERVICE.EXTRA_PLUGIN_RESULT_BUNDLE bundle via the pending intent received.

The RUN_COMMAND_SERVICE.EXTRA_PENDING_INTENT extra can be used to send the pending intent with which termux should return the result bundle. The pending intent can be received back by the app with an IntentService. Check RunCommandService for reference implementation.

For foreground commands (RUN_COMMAND_SERVICE.EXTRA_BACKGROUND is false):
- EXTRA_PLUGIN_RESULT_BUNDLE_STDOUT will contain session transcript.
- EXTRA_PLUGIN_RESULT_BUNDLE_STDERR will be null since its not used.
- EXTRA_PLUGIN_RESULT_BUNDLE_EXIT_CODE will contain exit code of session.

For background commands (RUN_COMMAND_SERVICE.EXTRA_BACKGROUND is true):
- EXTRA_PLUGIN_RESULT_BUNDLE_STDOUT will contain stdout of commands.
- EXTRA_PLUGIN_RESULT_BUNDLE_STDERR will contain stderr of commands.
- EXTRA_PLUGIN_RESULT_BUNDLE_EXIT_CODE will contain exit code of command.

The internal errors raised by termux outside the shell will be sent in the the EXTRA_PLUGIN_RESULT_BUNDLE_ERR and EXTRA_PLUGIN_RESULT_BUNDLE_ERRMSG extras. These will contain errors like if starting a termux command failed or if the user manually exited the termux sessions or android killed the termux service before the commands had finished executing. The err value will be Activity.RESULT_OK(-1) if no internal errors are raised.

The stdout and stderr will be truncated from the start to max 100KB combined and errmsg will also be truncated from end to max 25KB. This is necessary to prevent TransactionTooLargeException exceptions from being raised if stdout or stderr are too large in length. The original length of stdout and stderr will be provided in EXTRA_PLUGIN_RESULT_BUNDLE_STDOUT_ORIGINAL_LENGTH and EXTRA_PLUGIN_RESULT_BUNDLE_STDERR_ORIGINAL_LENGTH extras respectively, so that the caller can check if either of them were truncated.

### Termux:Tasker

Support for Termux:Tasker for getting back result of foreground commands will require an update to it since it currently immediately returns control to plugin host app like Tasker without waiting if a foreground command is to be executed.
2021-03-25 23:05:55 +05:00
.github github actions: add workflow for publishing terminal-view/terminal-emulator on Github Packages 2021-02-11 23:08:15 +02:00
app Add support for sending back background and foreground command results for RUN_COMMAND intent and foreground command results for Termux:Tasker 2021-03-25 23:05:55 +05:00
art icon: add regular png icon for compatibility with some launchers 2021-02-03 15:49:03 +02:00
fastlane/metadata/android/en-US add basic metadata for F-Droid. 2021-02-03 16:43:17 +02:00
gradle/wrapper Update plugins and gradle to latest versions 2021-01-01 18:12:53 +01:00
terminal-emulator Refactor TermuxActivity 2021-03-16 05:01:09 +05:00
terminal-view Update TerminalView and TerminalViewClient javadocs 2021-03-16 03:46:34 +05:00
.editorconfig Use 2 spaces for yaml files (.travis.yml) 2018-08-30 13:51:24 +02:00
.gitattributes update .gitattributes 2020-10-01 01:08:39 +03:00
.gitignore Include bootstrap zips as shared libraries 2019-10-20 20:15:50 +02:00
build.gradle Update plugins and gradle to latest versions 2021-01-01 18:12:53 +01:00
gradle.properties Set compileSdkVersion (NOT targetSdkVersion) to 29 so that Build.VERSION_CODES.Q checks can be made 2021-03-25 11:52:26 +05:00
gradlew gradle 6.6.1 2020-08-26 20:40:29 +03:00
gradlew.bat gradle 6.6.1 2020-08-26 20:40:29 +03:00
LICENSE.md Restructure library modules 2017-04-02 14:21:36 +02:00
README.md readme: remove links to Google Play and Nethunter stores 2021-02-03 02:56:53 +02:00
settings.gradle Remove float/ 2017-04-04 23:39:05 +02:00

Termux application

Build status Testing status Join the chat at https://gitter.im/termux/termux

Termux is an Android terminal application and Linux environment.

Note that this repository is for the app itself (the user interface and the terminal emulation). For the packages installable inside the app, see termux/termux-packages


@termux is looking for Termux Application maintainer for implementing new features, fixing bugs and reviewing pull requests since current one (@fornwall) is inactive.

Issue https://github.com/termux/termux-app/issues/1072 needs extra attention.


Installation

Termux application can be obtained from F-Droid.

Additionally we provide per-commit debug builds for those who want to try out the latest features or test their pull request. This build can be obtained from one of the workflow runs listed on Github Actions page.

Signature keys of all offered builds are different. Before you switch the installation source, you will have to uninstall the Termux application and all currently installed plugins.

Terminal resources

Terminal emulators