emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

process-file instead of call-process in proced.el?


From: Filipp Gunbin
Subject: process-file instead of call-process in proced.el?
Date: Fri, 25 Mar 2022 03:09:12 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin)

There's this TODO in proced.el:

--8<---------------cut here---------------start------------->8---
;; - Allow "sudo kill PID", "sudo renice PID"
--8<---------------cut here---------------end--------------->8---

WDYT, can we just use process-file instead of call-process?  Then, if
proced is opened from a /sudo:: (or su) buffer, and (setq
proced-signal-function "kill") is set, proced-send-signal "just works"
for processes owned by different user, with no special code in proced.

The simple patch is below.

Filipp.


diff --git a/lisp/proced.el b/lisp/proced.el
index c1d599afc4..7d324a37a3 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1833,7 +1833,7 @@ proced-send-signal
         (dolist (process process-alist)
           (with-temp-buffer
             (condition-case nil
-                (unless (zerop (call-process
+                (unless (zerop (process-file
                                 proced-signal-function nil t nil
                                 signal (number-to-string (car process))))
                   (proced-log (current-buffer))
@@ -1875,7 +1875,7 @@ proced-renice
     (dolist (process process-alist)
       (with-temp-buffer
         (condition-case nil
-            (unless (zerop (call-process
+            (unless (zerop (process-file
                             proced-renice-command nil t nil
                             priority (number-to-string (car process))))
               (proced-log (current-buffer))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]