]> git.eshelyaron.com Git - emacs.git/commit
Centralize subprocess creation in a single function.
authorPhilipp Stephani <phst@google.com>
Thu, 24 Dec 2020 14:27:45 +0000 (15:27 +0100)
committerPhilipp Stephani <phst@google.com>
Thu, 24 Dec 2020 14:34:23 +0000 (15:34 +0100)
commitbf7041a6f6ea2d57f842b9b2915cc58a90b01406
tree30576ef17b8ab3ba1514fd67e303635d21fa286e
parent3096437593ca6d1ea07809f7d0e2198705f20e55
Centralize subprocess creation in a single function.

Getting the vfork + execve combination right isn't easy, and the code
was partially duplicated between callproc.c and process.c.  Centralize
the spawn operation in a single function that deals with the nasty
details.  Going forward, we should be able to use posix_spawn from
either libc or Gnulib (or CreateProcessW on Windows) in the non-pty
case.

* src/callproc.c (emacs_spawn): New function to start an asynchronous
subprocess.  Merge code from 'call_process' and 'create_process' into
this function.
(call_process): Use new 'emacs_spawn' function.
(child_setup): Make static, since there are no users outside this
compilation unit left.
(CHILD_SETUP_TYPE): Move from header file, since there are no users
outside this compilation unit left.

* src/process.c (create_process): Use new 'emacs_spawn' function.
src/callproc.c
src/lisp.h
src/process.c