diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi index 606c5e719cb..2d95f5c8fef 100644 --- a/doc/emacs/android.texi +++ b/doc/emacs/android.texi @@ -364,17 +364,58 @@ consult the values of the variables @code{ctags-program-name}, @code{ebrowse-program-name}, and @code{rcs2log-program-name}. @xref{Subprocess Creation,,, elisp, the Emacs Lisp Reference Manual}. - The @file{/assets} directory containing Emacs start-up files is -meant to be inaccessible to processes not directly created by -@code{zygote}, the system service responsible for starting -applications. Since required Lisp is found in the @file{/assets} -directory, it would thus follow that it is not possible for Emacs to -start itself as a subprocess. A special binary named -@command{libandroid-emacs.so} is provided with Emacs, which tries its -best to start Emacs for the purpose of running Lisp in batch mode. -However, the approach it takes was devised by reading Android source -code, and is not sanctioned by the Android compatibility definition -documents, so your mileage may vary. + The @file{/assets} directory containing Emacs start-up files is meant +to be inaccessible to processes not directly created by @code{zygote}, +the system service responsible for starting applications. Since +required Lisp is found in the @file{/assets} directory, it would thus +follow that it is not possible for Emacs to start itself as a +subprocess. A special binary named @command{libandroid-emacs.so} is +provided with Emacs, which is installed into the library directory, and +which tries its best to start Emacs for the purpose of running Lisp in +batch mode. The approach it takes was devised by reference to Android +source code, and is not sanctioned by the Android compatibility +definition documents, so your mileage may vary. + +@cindex EMACS_CLASS_PATH environment variable, Android + Even when the location of the @command{libandroid-emacs.so} command is +known in advance, special configuration is required to run Emacs from +elsewhere than a subprocess of an existing Emacs session, as it must be +made to understand the location of resources and shared libraries in or +extracted from the installed application package. The OS command +@command{pm path org.gnu.emacs} will print the location of the +application package, and the adjacent @file{lib} directory will hold +shared libraries extracted from the same, though the said command must +be invoked in a peculiar manner to satisfy system restrictions on +communication between pseudoterminal devices created by user +applications and system services such as the package manager, which is +to say, with the standard IO streams redirected to a real file or a +pipe. Such values, once established, must be specified in the +environment variables @code{EMACS_CLASS_PATH} and +@code{EMACS_LD_LIBRARY_PATH}, so that this sample shell script may be +installed as @code{emacs} in any location that is accessible: + +@example +#!/system/bin/sh + +package_name=`pm path org.gnu.emacs 2>/dev/null #<%s> &" bufname) - (rx "[echo" (? ".exe") "] " (+ digit) "\n")) + (rx bos "[echo" (? ".exe") "] " (+ digit) "\n")) (eshell-wait-for-subprocess t)) (should (equal (buffer-string) "hi\n")))) @@ -129,6 +129,18 @@ bug#59469." (eshell-wait-for-subprocess t)) (should (equal (buffer-string) "olleh\n")))) +(ert-deftest esh-cmd-test/background/kill () + "Make sure that a background command that gets killed doesn't emit a prompt." + (skip-unless (executable-find "sleep")) + (let ((background-message (rx bos "[sleep" (? ".exe") "] " (+ digit) "\n"))) + (with-temp-eshell + (eshell-match-command-output "*sleep 10 &" background-message) + (kill-process (caar eshell-process-list)) + (eshell-wait-for-subprocess t) + ;; Ensure we didn't emit another prompt after killing the + ;; background process. + (should (eshell-match-output background-message))))) + ;; Lisp forms