3

I connected to my server:

$ ssh [email protected]

While in the server, I open a dtach session with vim:

$ dtach -c \tmp\my-dtach-session-pipe vim

Then my ssh session dies. I attempt to go back to my session:

$ ssh [email protected]
$ dtach -a \tmp\my-dtach-session-pipe

I do not get vim, but instead just a blinking cursor. I cannot do anything from there, not even ctrl+c, I can only detach the dtach with ctrl+\.

How can I get my dtach session back properly? Or am I missing the idea of how dtach is supposed to behave?

N.B. I am well aware of the tmux and screen utilities.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
kzh
  • 193
  • 1
  • 10
  • 1
    1. Why are you using backslash? 2. Why are you use dtatch instead of (arguably wider known and easier to use) screen or tmux? 3. Wouldn't it be better to open shell session inside the dtach session in which there would be vim session? Sometimes full-screen applications gets confused by changing screen size and suspend (C-z) and resume (`fg`) fix it. – Maciej Piechotka Jan 19 '11 at 17:44
  • I use `tmux`. I would like to learn `dtach` so that I can learn it and use it in combination with `dvtm`. – kzh Jan 19 '11 at 17:56
  • @Gilles thanks for adding the *dtach* tag. I would have if I had enough rep. – kzh Jan 20 '11 at 04:04

2 Answers2

3

I think you can prevent this by passing a WINCH signal to dtach:

dtach -c /tmp/my-dtach-session-pipe -r winch vim

Or at reattachment:

dtach -a /tmp/my-dtach-session-pipe -r winch
wag
  • 35,104
  • 11
  • 66
  • 51
  • I tried `dtach -a dtach-pipe -r winch` and that did not seem to re-attach my vim session, either, but if I use the `-r winch` option on creation (`-c`), it does work. Now the question is, if I forget to use `-r winch` can I get my `dtach` session back? – kzh Jan 19 '11 at 21:38
1

Perhaps you did get what you want, but you need to redraw the screen? Try pressing CTRL + L.

Steven D
  • 45,310
  • 13
  • 119
  • 114
bahamat
  • 38,658
  • 4
  • 70
  • 103
  • Incidentally, how do I make `ctrl+L` look like a keyboard button? – bahamat Jan 19 '11 at 20:07
  • 1
    element will give you the cool button thing, but not on comments. On another note, I had already tried `ctrl+L`, but it did not work, but you still get a +1 for a great suggestion. – kzh Jan 19 '11 at 20:09
  • Bummer, I was hoping that was it ;-) – bahamat Jan 20 '11 at 02:18