On Mon, Dec 6, 2010 at 7:54 PM, Benjamin R. Haskell wrote:
> If Vim receives a SIGWINCH (_sig_nal that the _win_dow _ch_anged size) while
> editing stdin, a program piping input to Vim gets killed prematurely.  Is
> there an easy way to avoid this?
>


Actually, it is Vim that terminates prematurely.
This is a bug in Vim: when vim receives the SIGWINCH signal, the
vim_read() call that is reading stdin, returns -1 and vim handles that
as an error in readfile().

read_stdin  --calls-->  open_buffer  --calls-->  readfile --calls-->  vim_read

The problem becomes (nearly) fixed when the signals are reset before
calling open_buffer() in read_stdin(), after having surrounded the call
to open_buffer() with the following two statements:

    // reset signals to their default
    reset_signals();
    (void)open_buffer(TRUE, NULL, 0);   /* create memfile and read file */
    // restore signals
    mch_init();

It is only "nearly" fixed, because when the window is resized, vim
does not restore the tty to sane attributes (icanon is not set for
example) after it has successfully done its job.

I am not sure if the hack above is acceptable. I will look into the tty
attributes problem.

-- 
Xavier

Les Chemins de Lokoti: http://lokoti.alwaysdata.net

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to