pkgsrc-Users archive

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

Re: perl bug? weird ctrl-z behaviour when piping from tin through perl

On 2009/09/09 19:35, Thomas Klausner wrote:
> Sometimes I pipe articles in tin(1) through a perl script that parses
> the output, does something and pipes it into less; when I quit less
> I'm back in tin and everything is fine.
> However, when I press ctrl-z (happens more often than I'd think) the
> terminal ends up in a strange state. The output is
>       Stopped. Type 'fg' to restart tin
> but I have no shell:
>       ls
>       (nothing)
> entering "fg" doesn't take me back to tin. Killing the perl and/or
> less processes doesn't help either, nor does pressing 'q' (as command
> for less or tin).
> A tin developer analysed the behaviour of tin for me:
> before popen(), tin does (feed.c:feed_articles() ~ line 616)
>         reset_shell_mode(3ncurses);
>         endwin(3ncurses);
> and after pclose() (feed.c:feed_articles() ~ line 855)
>         reset_prog_mode(3ncurses);
>         set_keypad_on(3ncurses);
> SIGTSTP causes (signal.c:handle_suspend())
>         set_keypad_off(3ncurses);
>         set_xclick_off(3ncurses);
>         reset_shell_mode(3ncurses);
>         kill(0, SIGSTOP);
>         reset_prog_mode(3ncurses);
>         set_keypad_on(3ncurses);
>         set_xclick_on(3ncurses);
> The developer claims that the double reset_shell_mode shouldn't hurt
> and that this looks ok (I think so as well).
> He reduced my test case to
>         cat|less
> and pressing ^Z, which works nicely, however piping through
>         perl -ne 'print $_;'|less
> and pressing ^Z confuses perl. This looks like a perl problem.
> Can someone shed more light on this?
>  Thomas

I don't have any light to shed, just a suggestion of a (better?) place to
ask the question.  Try posting a question to <> under
"Seekers of Perl Wisdom" (you can do this without registering on their
site).  There are many folks there who know the guts of Perl and/or would
take this as an interesting problem.


Home | Main Index | Thread Index | Old Index