master: sb-ext:process-kill: remove the option to use :pty-process-group

stassats via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  656925b3b1c634ad53e0295c6c2fe19c356802c0 (commit)
      from  d482d6751993be2a648d55f36b90b80e572c1889 (commit)

- Log -----------------------------------------------------------------
commit 656925b3b1c634ad53e0295c6c2fe19c356802c0
Author: Stas Boukarev <[email protected]>
Date:   Mon Apr 13 05:44:05 2026 +0300

    sb-ext:process-kill: remove the option to use :pty-process-group
    
    It has been using kill() instead of killpg() since 2009.
    find-current-foreground-process, tasked with finding the foreground
    pid, has been returning just (process-pid proc) since 1996.
    Actually returning the result of tcgetpgrp() just gives 0.
    Which would kill the calling process.
    Clearly:
    a) nobody has ever used this option
    b) nobody knows what it's supposed to do (or :pty t)
---
 src/code/run-program.lisp | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/src/code/run-program.lisp b/src/code/run-program.lisp
index 7a56bbf80..2b8a32699 100644
--- a/src/code/run-program.lisp
+++ b/src/code/run-program.lisp
@@ -287,35 +287,17 @@ PROCESS."
     (close-serve-event-pipe process))
   process)
 
-#-win32
-;;; Find the current foreground process group id.
-(defun find-current-foreground-process (proc)
-  (with-alien ((result int))
-    (multiple-value-bind
-          (wonp error)
-        (sb-unix:unix-ioctl (fd-stream-fd (process-pty proc))
-                            sb-unix:TIOCGPGRP
-                            (alien-sap (addr result)))
-      (unless wonp
-        (error "TIOCPGRP ioctl failed: ~S" (strerror error)))
-      result))
-  (process-pid proc))
-
 #-win32
 (defun process-kill (process signal &optional (whom :pid))
   "Hand SIGNAL to PROCESS. If WHOM is :PID, use the kill Unix system call. If
-   WHOM is :PROCESS-GROUP, use the killpg Unix system call. If WHOM is
-   :PTY-PROCESS-GROUP deliver the signal to whichever process group is
-   currently in the foreground.
+   WHOM is :PROCESS-GROUP, use the killpg Unix system call.
    Returns T if successful, otherwise returns NIL and error number (two values)."
-  (let ((pid (ecase whom
-               ((:pid :process-group)
-                (process-pid process))
-               (:pty-process-group
-                (find-current-foreground-process process)))))
-    (let ((result (if (eq whom :process-group)
-                      (sb-unix:unix-killpg pid signal)
-                      (sb-unix:unix-kill pid signal))))
+  (let ((pid (process-pid process)))
+    (let ((result (ecase whom
+                    (:process-group
+                     (sb-unix:unix-killpg pid signal))
+                    (:pid
+                     (sb-unix:unix-kill pid signal)))))
       (or (zerop result)
           (values nil (sb-unix::get-errno))))))
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.