Bram Moolenaar
unread,Oct 29, 2020, 2:35:00 PM10/29/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vim...@googlegroups.com, Marius Gedminas, Brennan Vincent, vim...@vim.org
Marius Gedminas wrote:
> On Wed, Oct 28, 2020 at 11:32:42AM +0100, Bram Moolenaar wrote:
> > Brennan Vincent wrote:
> >
> > > Let's simulate a read that will block forever:
> > >
> > > $ mkfifo /tmp/myfifo
> > > $ vim /tmp/myfifo
> > >
> > > Now vim hangs permanently; it cannot be killed or suspended except by
> > > going to another terminal and running `pkill -9 vim`. (Or, of course,
> > > writing stuff to the fifo, but the point here wasn't about fifos
> > > specifically, but just about reads that are slow to return for whatever
> > > reason).
> > >
> > > Same story with :w or :w! to a file that is slow to write.
> > >
> > > IMO, this "hang forever and give the user no way to recover" behavior is
> > > a bug, but reasonable people might disagree.
> >
> > It's not so easy to make this work, especially with a fifo. Vim is in
> > raw mode, thus a CTRL-C is not turned into an interrupt. We could
> > switch to cooked mode for that, but then any typeahead is becoming a
> > problem.
>
> Would switching to cbreak mode help? It works like raw, but converts ^C
> to an interrupt.
It's worth a try: basically use RAW mode, with the exception that the
"ISIG" flag is set. This can be implemented in mch_settmode() with a
new argument TMODE_RAW. Would have to do this for all implementations
of mch_settmode().
> (I'm not sure exactly when, but it seems to me that in the last year or
> so modern versions of Vim became harder to interrupt with ^C, especially
> when a plugin is running.)
Well, if a plugin keeps the CPU busy, it may not checked for typed
characters.
--
hundred-and-one symptoms of being an internet addict:
149. You find your computer sexier than your girlfriend