From ff630b56939541752097e5cc87c3db1de68d4c5f Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 24 Jan 2020 14:42:12 +0100 Subject: [PATCH] Adapt tramp-test32-shell-command * test/lisp/net/tramp-tests.el (tramp-test32-shell-command): Test error buffer for synchronous `shell-command' only. --- test/lisp/net/tramp-tests.el | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 247f878d3c5..129652839c4 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4492,25 +4492,20 @@ INPUT, if non-nil, is a string sent to the process." (buffer-string)))) ;; Cleanup. - (ignore-errors (delete-file tmp-name))) + (ignore-errors (delete-file tmp-name)))) - ;; Test `{async-}shell-command' with error buffer. - (let ((stderr (generate-new-buffer "*stderr*"))) - (unwind-protect - (with-temp-buffer - (funcall - this-shell-command "cat /; sleep 1" (current-buffer) stderr) - ;; Check stderr. - (when (eq this-shell-command #'tramp--test-async-shell-command) - (ignore-errors - (delete-process (get-buffer-process (current-buffer))))) - (should (zerop (buffer-size))) - (with-current-buffer stderr - (should - (string-match "cat:.* Is a directory" (buffer-string))))) + ;; Test `shell-command' with error buffer. + (let ((stderr (generate-new-buffer "*stderr*"))) + (unwind-protect + (with-temp-buffer + (shell-command "echo foo; echo bar >&2" (current-buffer) stderr) + (should (string-equal "foo\n" (buffer-string))) + ;; Check stderr. + (with-current-buffer stderr + (should (string-equal "bar\n" (buffer-string))))) - ;; Cleanup. - (ignore-errors (kill-buffer stderr))))) + ;; Cleanup. + (ignore-errors (kill-buffer stderr)))) ;; Test sending string to `async-shell-command'. (unwind-protect -- 2.39.2