in reply to Prompting for input inside IDE run (was Reading from STDIN)
How do you run those programs inside emacs? I guess this is on Windows? Are you using Powershell as your shell-file-name?
One annoying effect I see on Windows is that STDOUT is buffered. So, if you're expecting a prompt, then you won't see it in time, but you can still enter your input line when the program seems to "hang". The w32 FAQ has a workaround for "Perl script buffering".
I could run the following program under M-x perldb and M-x eshell, and it behaves as I would expect:
use 5.028; # Turn all buffering off. select((select(STDOUT), $| = 1)[0]); select((select(STDERR), $| = 1)[0]); select((select(STDIN), $| = 1)[0]); print "Give me a cookie: "; my $thing = readline(STDIN); $thing =~ /^(a )?cookie$/ or die "That was no cookie.\n"; say "Thanks and goodbye!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Prompting for input inside IDE run (was Reading from STDIN)
by LanX (Saint) on Mar 27, 2023 at 12:45 UTC | |
by haj (Vicar) on Mar 27, 2023 at 14:52 UTC | |
by LanX (Saint) on Mar 27, 2023 at 14:57 UTC |