summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--terminal-here.el11
-rw-r--r--test/terminal-here-test.el5
2 files changed, 14 insertions, 2 deletions
diff --git a/terminal-here.el b/terminal-here.el
index d7a1a3c..0820ef9 100644
--- a/terminal-here.el
+++ b/terminal-here.el
@@ -70,8 +70,15 @@ buffer is not in a project."
(funcall terminal-here-terminal-command dir)
terminal-here-terminal-command))
(process-name (car term-command))
- (default-directory dir))
- (apply #'start-process process-name nil term-command)))
+ (default-directory dir)
+ (proc (apply #'start-process process-name nil term-command)))
+ (set-process-sentinel
+ proc
+ (lambda (proc _)
+ (when (and (eq (process-status proc) 'exit) (/= (process-exit-status proc) 0))
+ (message "Error: in terminal here, command `%s` exited with error code %d"
+ (mapconcat #'identity term-command " ")
+ (process-exit-status proc)))))))
;;;###autoload
(defun terminal-here-launch ()
diff --git a/test/terminal-here-test.el b/test/terminal-here-test.el
index bf84f10..8e8cab7 100644
--- a/test/terminal-here-test.el
+++ b/test/terminal-here-test.el
@@ -2,6 +2,7 @@
(ert-deftest linux-default-command ()
(with-mock
+ (mock (set-process-sentinel))
(mock (start-process "x-terminal-emulator" * "x-terminal-emulator"))
(let ((system-type 'gnu/linux))
(custom-reevaluate-setting 'terminal-here-terminal-command)
@@ -9,6 +10,7 @@
(ert-deftest osx-default-command ()
(with-mock
+ (mock (set-process-sentinel))
(mock (start-process "open" * "open" "-a" "Terminal.app" "adir"))
(let ((system-type 'darwin))
(custom-reevaluate-setting 'terminal-here-terminal-command)
@@ -16,6 +18,7 @@
(ert-deftest windows-default-command ()
(with-mock
+ (mock (set-process-sentinel))
(mock (start-process "cmd.exe" * "cmd.exe" "/C" "start" "cmd.exe"))
(let ((system-type 'windows-nt))
(custom-reevaluate-setting 'terminal-here-terminal-command)
@@ -25,12 +28,14 @@
(ert-deftest custom-terminal-command-as-list ()
(with-mock
+ (mock (set-process-sentinel))
(mock (start-process "1" * "1" "2" "3"))
(validate-setq terminal-here-terminal-command '("1" "2" "3"))
(terminal-here-launch-in-directory "adir")))
(ert-deftest custom-terminal-command-as-function ()
(with-mock
+ (mock (set-process-sentinel))
(mock (start-process "1" * "1" "2" "3" "adir"))
(validate-setq terminal-here-terminal-command (lambda (dir) (list "1" "2" "3" dir)))
(terminal-here-launch-in-directory "adir")))