editing a pipe (oops)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

editing a pipe (oops)

William Pursell
I accidentally attempted to open a named pipe.
(ie, I typed ":e foo" where foo was not a regular file.)
As expected, vim blocked.  So now I'm sitting at the
command prompt waiting...and I can't get off of it.
^-c, ^-z, ^-d and
<ctrl><random key struck with force> all do nothing.
I had to send a SIGTERM to vim to get out of it.

Any thoughts on a cleaner way to recover from that?
Reply | Threaded
Open this post in threaded view
|

Re: editing a pipe (oops)

Thor Andreassen
On Sat, Mar 04, 2006 at 06:05:37AM +0000, bill wrote:
> I accidentally attempted to open a named pipe.
> (ie, I typed ":e foo" where foo was not a regular file.)
> As expected, vim blocked.  So now I'm sitting at the
> command prompt waiting...and I can't get off of it.
> ^-c, ^-z, ^-d and
> <ctrl><random key struck with force> all do nothing.
> I had to send a SIGTERM to vim to get out of it.
>
> Any thoughts on a cleaner way to recover from that?

If you have write access to this named pipe, sending EOF to the pipe
works for me. Fx. you could do something like:

$ echo "" > NAMED_PIPE

But for some reason you have to do this twice.

--
with kind regards
Thor Andreassen
Reply | Threaded
Open this post in threaded view
|

Re: editing a pipe (oops)

William Pursell
Thor Andreassen wrote:

> On Sat, Mar 04, 2006 at 06:05:37AM +0000, bill wrote:
>
>>I accidentally attempted to open a named pipe.
>>(ie, I typed ":e foo" where foo was not a regular file.)
>>As expected, vim blocked.  So now I'm sitting at the
>>command prompt waiting...and I can't get off of it.
>>^-c, ^-z, ^-d and
>><ctrl><random key struck with force> all do nothing.
>>I had to send a SIGTERM to vim to get out of it.
>>
>>Any thoughts on a cleaner way to recover from that?
>
>
> If you have write access to this named pipe, sending EOF to the pipe
> works for me. Fx. you could do something like:
>
> $ echo "" > NAMED_PIPE
>
> But for some reason you have to do this twice.
>
That works, but I'm concerned if I don't have write
access to the pipe.  I did this in a safe environment
where it didn't really matter, but now I'm paranoid that
someday I'll be in the middle of "very important" editing
where I've just written the most important line of code
in the history of the known universe and I'll end up in
this situation where I can't get off the command line.

It seems that vim should maybe stat the file that you
are attempting to open and return an error if it's not
a regular file.