help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] issue with emacs and msvcrt getch(?)


From: Eli Zaretskii
Subject: Re: [h-e-w] issue with emacs and msvcrt getch(?)
Date: Wed, 04 May 2011 06:02:43 -0400

> Date: Tue, 3 May 2011 19:54:06 -0400
> From: "E. S." <address@hidden>
> 
> A few months ago I tried running the db2 CLP from within emacs but it kept
> hanging at the password prompt. I noticed similar behavior if, in python, I
> used getpass.getpass(). That function works fine until I get to
> msvcrt.getch(), which hangs in the python comint buffer (using
> python-mode.el if anybody's interested). The getpass function loops like
> this:
> 
> while 1:
>     c = msvcrt.getch()
>     if c == '\r' or c == '\n':
>         break
>     ...
>     else:
>         pw = pw + c
> 
> If I modify slightly and check just msvcrt.kbhit() in a loop to see if any
> keystroke ever gets noticed, that function never returns true; I thought
> that maybe it was just a getch thing. I can only guess that the db2 CLP is
> also trying to make a low-level call to the windows api, but it's not
> working correctly from within emacs (outside of emacs everything works
> fine).

Could this have something to do with the fact that Emacs has a
separate input thread that wants to get keyboard inputs from the same
console?  Could it be that Emacs and getch fight for the same inputs,
and Emacs wins?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]