emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 7a608fc: * lisp/progmodes/python.el: Be more care


From: Stefan Monnier
Subject: [Emacs-diffs] emacs-26 7a608fc: * lisp/progmodes/python.el: Be more careful about temp file removal
Date: Sun, 14 Apr 2019 18:45:41 -0400 (EDT)

branch: emacs-26
commit 7a608fc6f3ded3e615e7accb29f16bfd290d80a1
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/progmodes/python.el: Be more careful about temp file removal
    
    (python-shell-prompt-detect): Use unwind-protect to try and not leave
    file behind in case of error.
---
 lisp/progmodes/python.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 27d31ab..38dcc82 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2266,15 +2266,16 @@ detection and just returns nil."
                          ;; carriage returns in unbuffered mode.
                          (let ((inhibit-eol-conversion (getenv 
"PYTHONUNBUFFERED")))
                            (python-shell--save-temp-file code))))
-                    ;; Use `process-file' as it is remote-host friendly.
-                    (process-file
-                     interpreter
-                     code-file
-                     '(t nil)
-                     nil
-                     interpreter-arg)
-                    ;; Try to cleanup
-                    (delete-file code-file)))
+                    (unwind-protect
+                        ;; Use `process-file' as it is remote-host friendly.
+                        (process-file
+                         interpreter
+                         code-file
+                         '(t nil)
+                         nil
+                         interpreter-arg)
+                      ;; Try to cleanup
+                      (delete-file code-file))))
                 (buffer-string)))
              (prompts
               (catch 'prompts



reply via email to

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