Subject: Re: [[email-masked]: Re[2]: Emacs and Perl bad interaction]

From: Andrew Innes <[email-masked]>
Date: Mon, 1 Jul 1996 15:38:42 +0100

On Sun, 30 Jun 1996 04:26:22 -0400, Richard Stallman <[email-masked]> said:
>Is this the same problem with running DOS subprocesses that we already
>know about?

No, Perl is a native Win32 program.  I'd noticed a long time ago that
"perl -de 0" just seems to hang under Emacs, but never tried to
invesigate further.

The fault lies with Perl (indirectly with NT/Win95).

The problem is that the Perl debugger explicitly opens a connection to
"CON", which is the DOS/NT equivalent of "/dev/tty", for interacting
with the user.

On Unix, this is okay, because Emacs (or the shell?) creates a
pseudo-tty so that /dev/tty is really the pipe Emacs is using to
communicate with the subprocess.

On NT, this fails because CON always refers to the handle for the
relevant console (approximately equivalent to a tty), and cannot be
redirected to refer to the pipe Emacs assigned to the subprocess as
stdin.

[
This behaviour of NT causes problems with other programs as well - for
example, the standard ftp program on NT always prompts and reads the
password explicitly from CON, which means ange-ftp cannot work with it.

In the case of ange-ftp, we found the source for a POSIX ftp program
and replaced getpass with a version I wrote that doesn't do this.
]

In this case, there is a work-around.  The source for the Perl debugger
is included with Perl (lib/perldb.pl) - although it appears to prefer
having a separate channel for user interaction so as not to interfere
with the debuggee's use of STDIN/STDOUT, it will use STDIN/STDOUT if
necessary.  So, the user can modify perldb.pl to always use STDIN/STDOUT.

I've tested this briefly to verify that it works, at least for simple
things.

AndrewI