[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fri, 26 Sep 2014 10:38:15 +0100
> An Elisp program communicating with a subprocess is typically written
> (let* ((process-connection-type nil)
> (process (start-process "cat" nil "cat" "/etc/motd")))
> (set-process-filter process #'my-filter)
> (set-process-sentinel process #'my-sentinel)
> It is a bit tricky and error prone. On the other hand, Python and GLib
> provide a simple way to spawn and communicate with subprocess:
> So I would like to propose something similar:
> * Provide a function 'make-subprocess' similar to 'make-network-process'
> or 'make-serial-process', which can be used as:
> (make-subprocess :name "cat" :program "cat" :args '("/etc/motd")
> :filter #'my-filter :sentinel #'my-sentinel
> :coding '(utf-8 . utf-8))
> * Rewrite 'start-process' as an Elisp wrapper around 'make-subprocess'.
> This also has the following benefits:
> * We could collect stderr output naturally. 'make-subprocess' could
> have a keyword, say :error, to prepare a pipe for stderr when spawning
> a process.
> * Maybe it could share the same code to handle the standard keywords
> (:coding, :filter, :sentinel, etc.) with 'make-network-process' and
> What do people think? I'm attaching a patch as POC.
I like the idea. I've written several wrappers that do this myself.
What about make-network-process? that could be extended to take the same
sentinel and filter arguments.
I think your function should be called:
to fit in with make-network-process.
I'd also like to have a:
function which would make a particular sentinel the default if one was
not specified. Maybe make-sub-process and make-network-process could
have a default-sentinel variable that they consulted if a sentinel was
- make-subprocess, Daiki Ueno, 2014/09/26
- Re: make-subprocess,
Nic Ferrier <=