bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#8929: 24.0.50; tramp hangs when process died


From: Sébastien Gross
Subject: bug#8929: 24.0.50; tramp hangs when process died
Date: Fri, 24 Jun 2011 15:21:38 +0200

Hi,

Using tramp to edit remote files creates some ssh processes.

When this process dies for some reasons (such ad IP change or network
outrage), the associated buffer is still alive and makes tramp hanging
when trying to reconnect the remote host.

This behavior happens every time I carry my laptop (in suspend to disk
or suspend to ram mode) from my home to my office (or the way back).


Here is a patch (for tramp-sh.el) to add a sentinel that kills the
process buffer when the process exit:

--- tramp-sh.el.o       2011-06-24 14:44:09.023169775 +0200
+++ tramp-sh.el 2011-06-24 14:52:57.383172776 +0200
@@ -4277,6 +4277,13 @@
                       (tramp-get-connection-buffer vec)
                       tramp-encoding-shell))))
 
+           ;; Kill buffer when process died.
+           (set-process-sentinel
+            p
+            (lambda (proc change)
+              (when (eq (process-status proc) 'exit)
+                (kill-buffer (process-buffer proc)))
+
            (tramp-message
             vec 6 "%s" (mapconcat 'identity (process-command p) " "))


Hope this doesn't break anything.

Cheers.



In GNU Emacs 24.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2011-05-23 on builder1-tc2ams, modified by Debian
 (emacs-snapshot package, version 1:20110520-1+squeeze)
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  '--build' 'x86_64-linux-gnu' '--host' 
'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' 
'--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' 
'--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.0.50/site-lisp:/usr/share/emacs/site-lisp'
 '--without-compress-info' '--with-x=yes' '--with-x-toolkit=gtk' 
'--with-imagemagick=yes' 'build_alias=x86_64-linux-gnu' 
'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 
-g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

-- 
Sébastien Gross





reply via email to

[Prev in Thread] Current Thread [Next in Thread]