diff options
| author | Philipp Stephani | 2018-01-08 21:51:44 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2018-01-10 15:43:52 +0100 |
| commit | 9c2b11484f8a5a07c748a18a872947c5c062883b (patch) | |
| tree | 273a81d28a47997c0076babf9a403a249f9095fd | |
| parent | 3efb1e7defc6bc4eeebbf05d9d4bf2d0deb5a4c1 (diff) | |
| download | emacs-9c2b11484f8a5a07c748a18a872947c5c062883b.tar.gz emacs-9c2b11484f8a5a07c748a18a872947c5c062883b.zip | |
Inherit query-on-exit flag to stderr process (Bug#30031)
* src/process.c (Fmake_process): Have the pipe process honor the
parent's query-on-exit flag.
* test/src/process-tests.el (make-process/noquery-stderr): New test.
| -rw-r--r-- | src/process.c | 8 | ||||
| -rw-r--r-- | test/src/process-tests.el | 19 |
2 files changed, 25 insertions, 2 deletions
diff --git a/src/process.c b/src/process.c index 94d9f8c6a5c..36fb8a70cf1 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1686,6 +1686,8 @@ usage: (make-process &rest ARGS) */) | |||
| 1686 | if (!NILP (program)) | 1686 | if (!NILP (program)) |
| 1687 | CHECK_STRING (program); | 1687 | CHECK_STRING (program); |
| 1688 | 1688 | ||
| 1689 | bool query_on_exit = NILP (Fplist_get (contact, QCnoquery)); | ||
| 1690 | |||
| 1689 | stderrproc = Qnil; | 1691 | stderrproc = Qnil; |
| 1690 | xstderr = Fplist_get (contact, QCstderr); | 1692 | xstderr = Fplist_get (contact, QCstderr); |
| 1691 | if (PROCESSP (xstderr)) | 1693 | if (PROCESSP (xstderr)) |
| @@ -1701,7 +1703,9 @@ usage: (make-process &rest ARGS) */) | |||
| 1701 | QCname, | 1703 | QCname, |
| 1702 | concat2 (name, build_string (" stderr")), | 1704 | concat2 (name, build_string (" stderr")), |
| 1703 | QCbuffer, | 1705 | QCbuffer, |
| 1704 | Fget_buffer_create (xstderr)); | 1706 | Fget_buffer_create (xstderr), |
| 1707 | QCnoquery, | ||
| 1708 | query_on_exit ? Qnil : Qt); | ||
| 1705 | } | 1709 | } |
| 1706 | 1710 | ||
| 1707 | proc = make_process (name); | 1711 | proc = make_process (name); |
| @@ -1715,7 +1719,7 @@ usage: (make-process &rest ARGS) */) | |||
| 1715 | pset_filter (XPROCESS (proc), Fplist_get (contact, QCfilter)); | 1719 | pset_filter (XPROCESS (proc), Fplist_get (contact, QCfilter)); |
| 1716 | pset_command (XPROCESS (proc), Fcopy_sequence (command)); | 1720 | pset_command (XPROCESS (proc), Fcopy_sequence (command)); |
| 1717 | 1721 | ||
| 1718 | if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) | 1722 | if (!query_on_exit) |
| 1719 | XPROCESS (proc)->kill_without_query = 1; | 1723 | XPROCESS (proc)->kill_without_query = 1; |
| 1720 | if (tem = Fplist_get (contact, QCstop), !NILP (tem)) | 1724 | if (tem = Fplist_get (contact, QCstop), !NILP (tem)) |
| 1721 | pset_command (XPROCESS (proc), Qt); | 1725 | pset_command (XPROCESS (proc), Qt); |
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 34309a5817d..7d355602297 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el | |||
| @@ -162,5 +162,24 @@ | |||
| 162 | (error nil)))) | 162 | (error nil)))) |
| 163 | (should (equal path samepath)))) | 163 | (should (equal path samepath)))) |
| 164 | 164 | ||
| 165 | (ert-deftest make-process/noquery-stderr () | ||
| 166 | "Checks that Bug#30031 is fixed." | ||
| 167 | (skip-unless (executable-find "sleep")) | ||
| 168 | (with-temp-buffer | ||
| 169 | (let* ((previous-processes (process-list)) | ||
| 170 | (process (make-process :name "sleep" | ||
| 171 | :command '("sleep" "1h") | ||
| 172 | :noquery t | ||
| 173 | :connection-type 'pipe | ||
| 174 | :stderr (current-buffer)))) | ||
| 175 | (unwind-protect | ||
| 176 | (let ((new-processes (cl-set-difference (process-list) | ||
| 177 | previous-processes | ||
| 178 | :test #'eq))) | ||
| 179 | (should new-processes) | ||
| 180 | (dolist (process new-processes) | ||
| 181 | (should-not (process-query-on-exit-flag process)))) | ||
| 182 | (kill-process process))))) | ||
| 183 | |||
| 165 | (provide 'process-tests) | 184 | (provide 'process-tests) |
| 166 | ;; process-tests.el ends here. | 185 | ;; process-tests.el ends here. |