Hi,
In xemacs-21.5.14 (and earlier versions as well) the following code is
found in src/process-unix.c (previously called src/callproc.c) around
line 1012
*SNIP*
/* Close non-process-related file descriptors. It would be cleaner to
close just the ones that need to be, but the following brute
force approach is certainly effective, and not too slow. */
{
int fd;
for (fd = 3; fd < MAXDESC; fd++)
retry_close (fd);
}
*SNIP*
As the comment section explains, this is a very quick and dirty hack. In
our case it prevents us from using xemacs as an editor in a sequence of
pipe-connected programs.
A == XEmacs == B
| |
+--------------+
We have program A create a set of pipes, then fork+exec XEmacs, which
then uses (start-process ...) to create program B, which not only needs
to communicate with the XEmacs session, but also with the original
program A. Since XEmacs blatantly closes all filedescriptors except
std{in,out,err}, program B can no longer use the pipe to program A.
In xemacs-21.4.8 the comment header for this hack was slightly
different:
*SNIP*
/* I can't think of any reason why child processes need any more
than the standard 3 file descriptors. It would be cleaner to
close just the ones that need to be, but the following brute
force approach is certainly effective, and not too slow. */
*SNIP*
After our explanation maybe you now see "why child processes need any
more than the standard 3 file descriptors." and that just removing this
line from the comment is not enough to fix the problem.
As a comparison, check the same relevant section in GNU Emacs 21.2.21
which shows:
*SNIP*
emacs_close (0);
emacs_close (1);
emacs_close (2);
dup2 (in, 0);
dup2 (out, 1);
dup2 (err, 2);
emacs_close (in);
emacs_close (out);
emacs_close (err);
*SNIP*
They (GNU Emacs) only close the relevant filedescriptors, which is why
our approach using pipes works perfectly with GNU Emacs.
Please let me know if there is a version of XEmacs that addresses this
issue, or whether you intend to fix it in some upcoming release. Until
then we are unable to add xemacs to our list of supported editors which
so far includes GNU Emacs, GVIM and Eclipse.
Regards,
--
Hayco de Jong, Centre for Mathematics and Computer Science (CWI)
Kruislaan 413, NL 1098 SJ Amsterdam, The Netherlands
room M336, phone +31 20 592-4007
url:
www.cwi.nl/~jong e-mail: jong(a)cwi.nl