Subject: Re: bug#56002: src/process.c; make-process fails to clean up stderr process on early exit

From: Eli Zaretskii <[email-masked]>
Date: Mon, 08 Aug 2022 14:57:30 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked]
> Date: Mon, 08 Aug 2022 13:36:58 +0200
> 
> Tom Gillespie <[email-masked]> writes:
> 
> > * src/process.c (Fmake_process): Move the call to create the stderr
> > process as late as possible to avoid having to clean up stderrproc in
> > the event of an error prior to the call to create_process. This change
> > is needed to ensure that when called with :query-stderr t (aka the
> > default behavior prior to the addition of :query-stderr) make-process
> > will not leak the stderr process if a call to make-process fails.
> > Also adds a new keyword argument :query-stderr to control whether to
> > query on exit the stderr process (if one is created). (bug#56002)
> 
> I think this makes sense...  Eli, any comments?

TBH, I don't understand the rationale well enough.  What does it mean
we "leak stderr process"? isn't the stderr process recycled if
make-process fails?  Is it just a matter of some simple change in the
control flow, to make sure we always go through the cleanup code
before we return?

In general, I'd prefer not to change timing of what we do in
make-process unless it's really unavoidable.  There's a lot of
system-dependent stuff there, and who knows what will that cause on
some platform?