diff options
author | Xiyue Deng <manphiz@gmail.com> | 2023-09-17 11:43:14 -0700 |
---|---|---|
committer | Xiyue Deng <manphiz@gmail.com> | 2023-10-04 01:15:57 -0700 |
commit | 8b241320494eafe4e5bf479452847862733d9fb6 (patch) | |
tree | ff4727b0fa882f22bc78f043f70f9240b3a1fbb6 /debian-bug.el | |
parent | 07c03e0c12c2ae8765dcbb73c31ad609474e1943 (diff) |
Run term-exec without hooks to be more robust.
* This prevents user defined term-exec-hook from interrupting interactive
commands running in term-exec.
Diffstat (limited to 'debian-bug.el')
-rw-r--r-- | debian-bug.el | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/debian-bug.el b/debian-bug.el index ea6ea3f..ed8e6c8 100644 --- a/debian-bug.el +++ b/debian-bug.el @@ -855,6 +855,18 @@ with `set-process-sentinel' directly, but requires some tweaking instead." (debian-bug-compose-report package severity subject filename bug-script-temp-file)))) +(defun debian-bug--safe-term-exec (buffer name command startfile switches) + "Runs term-exec without any hooks. + +This protects the term-exec session from potentially being +affected by user installed hooks when the command may ask for +user input." + (let ((old-term-exec-hook term-exec-hook) + (term-exec-hook nil)) + (unwind-protect + (term-exec buffer name command startfile switches) + (setq term-exec-hook old-term-exec-hook)))) + (defun debian-bug-run-bug-script (package severity subject filename) "Run a script, if provided by PACKAGE, to collect information. The information about the package which should be supplied with @@ -889,8 +901,9 @@ reporting process by calling `debian-bug-compose-report'." (with-current-buffer bug-script-buffer (erase-buffer) (term-mode) - (term-exec bug-script-buffer "debian-bug-script" handler nil - (list bug-script bug-script-temp-file)) + (debian-bug--safe-term-exec + bug-script-buffer "debian-bug-script" handler nil + (list bug-script bug-script-temp-file)) (setq bug-script-process (get-buffer-process bug-script-buffer)) |