summaryrefslogtreecommitdiff
path: root/test/lisp/net
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2020-05-16 14:04:07 +0200
committerMichael Albinus <michael.albinus@gmx.de>2020-05-16 14:04:07 +0200
commitbbbab82a7117e08a77433f5ad39b34f5e03a014c (patch)
tree52ce224c6f704873ebbb2c50d9203592c2baea5f /test/lisp/net
parentdba8f3783b209fef5be2589528ed43a99a8bab6a (diff)
downloademacs-bbbab82a7117e08a77433f5ad39b34f5e03a014c.tar.gz
emacs-bbbab82a7117e08a77433f5ad39b34f5e03a014c.tar.bz2
emacs-bbbab82a7117e08a77433f5ad39b34f5e03a014c.zip
Introduce process-file-return-signal-string
* doc/lispref/processes.texi (Synchronous Processes): Describe `process-file-return-signal-string'. * doc/misc/tramp.texi: Adapt Tramp and Emacs version numbers. (Remote processes): Describe `process-file-return-signal-string' and $INSIDE_EMACS. * etc/NEWS: Describe `process-file-return-signal-string'. Fix typos. * lisp/simple.el (process-file-return-signal-string): New user option. * lisp/net/tramp-adb.el (tramp-adb-handle-process-file): * lisp/net/tramp-sh.el (tramp-sh-handle-process-file): Use it. * lisp/net/tramp.el (tramp-get-signal-strings): New defun. * test/lisp/net/tramp-tests.el (tramp-test28-process-file): Adapt test.
Diffstat (limited to 'test/lisp/net')
-rw-r--r--test/lisp/net/tramp-tests.el30
1 files changed, 20 insertions, 10 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index de85f83982c..1f56baad7ce 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -75,6 +75,7 @@
;; Needed for Emacs 26.
(defvar async-shell-command-width)
;; Needed for Emacs 27.
+(defvar process-file-return-signal-string)
(defvar shell-command-dont-erase-buffer)
;; Beautify batch mode.
@@ -4208,18 +4209,27 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(should (zerop (process-file "true")))
(should-not (zerop (process-file "false")))
(should-not (zerop (process-file "binary-does-not-exist")))
- (should
- (= 42
+ ;; Return exit code.
+ (should (= 42 (process-file
+ (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh")
+ nil nil nil "-c" "exit 42")))
+ ;; Return exit code in case the process is interrupted,
+ ;; and there's no indication for a signal describing string.
+ (let (process-file-return-signal-string)
+ (should
+ (= (+ 128 2)
+ (process-file
+ (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh")
+ nil nil nil "-c" "kill -2 $$"))))
+ ;; Return string in case the process is interrupted and
+ ;; there's an indication for a signal describing string.
+ (let ((process-file-return-signal-string t))
+ (should
+ (string-equal
+ "Interrupt"
(process-file
(if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh")
- nil nil nil "-c" "exit 42")))
- ;; Return string in case the process is interrupted.
- (should
- (string-equal
- "Signal 2"
- (process-file
- (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh")
- nil nil nil "-c" "kill -2 $$")))
+ nil nil nil "-c" "kill -2 $$"))))
(with-temp-buffer
(write-region "foo" nil tmp-name)