diabelek has asked for the wisdom of the Perl Monks concerning the following question:
We're trying to automate the testing of some apps and one of them in Windows will hang the Perl script when it tries to get a password using _getch. We can change either our scripts or the app but we're stuck on how since we need to hide the password and _getch is the only way we know of doing it (that's halfway cross platform) and we don't know of a way to automate it in windows. In Linux, we are able to use Proc::Spawn without any problem (same basic code base for the app with if defs around sections).
BTW, we're using open to get a piped filehandle to the app in windows.
Comment on use of getch in C apps hangs perl when reading/writing to filehandles
If I read you correctly, you are trying to write the password to the C program using a pipe? I have had similar problems. I'm guessing that _getch() on Windows is not using vanilla STDIN but using console features instead (hence the #include <conio.h>).
The way I got around this in C was to use _isatty() (cross-platform), and only use _getch() if we are connected to a tty, otherwise use getchar().