emacs-devel
[Top][All Lists]
Advanced

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

start-process: nil check on arg program


From: Tino Calancha
Subject: start-process: nil check on arg program
Date: Thu, 25 Aug 2016 15:06:53 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)


Hi,

this is a question about
* lisp/subr.el (start-process)

I don't see the point for the nil check on program.

* program is a mandatory argument: if program is missing, for instance
(start-process "foo" "buf")
before the check run you already get a
'Wrong-number-of-arguments' error.

* If program is nil, for instance,
(start-process "foo" "buf" nil)
which IMO it shouldn't ever happend, that check don't
prevent the creation of a useless process.


I guess the nil check for program should be before the call to `apply'
(as in following patch) or not be included at all.
What do you think?

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/lisp/subr.el b/lisp/subr.el
index 8ab1178..632a9e6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2003,10 +2003,10 @@ start-process
 one of them using the shell syntax."
   (unless (fboundp 'make-process)
     (error "Emacs was compiled without subprocess support"))
-  (apply #'make-process
-        (append (list :name name :buffer buffer)
-                (if program
-                    (list :command (cons program program-args))))))
+  (when program
+    (apply #'make-process
+           (append (list :name name :buffer buffer
+                         :command (cons program program-args))))))

 (defun process-lines (program &rest args)
   "Execute PROGRAM with ARGS, returning its output as a list of lines.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Tino



reply via email to

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