unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* start-process: nil check on arg program
@ 2016-08-25  6:06 Tino Calancha
  2016-08-25  6:43 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Tino Calancha @ 2016-08-25  6:06 UTC (permalink / raw)
  To: Emacs developers; +Cc: tino.calancha


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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-25  7:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-25  6:06 start-process: nil check on arg program Tino Calancha
2016-08-25  6:43 ` Andreas Schwab
2016-08-25  6:58   ` Tino Calancha
2016-08-25  7:11     ` Andreas Röhler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).