From 18356642a3bc95bde7ac87149336c74131cd6ca4 Mon Sep 17 00:00:00 2001 From: Guilherme Affonso Date: Wed, 7 Sep 2022 17:09:30 +0900 Subject: [PATCH] Block both streams when loading files (#10) --- src/euslime/handler.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/euslime/handler.py b/src/euslime/handler.py index feb7421..82003cc 100644 --- a/src/euslime/handler.py +++ b/src/euslime/handler.py @@ -544,9 +544,14 @@ def swank_compile_file_if_needed(self, filename, loadp): seconds, loadp, filename]) def swank_load_file(self, filename): + # Block both streams while loading a file (issue #10) + # Maybe there are other alternatives? lock = self.euslisp.euslime_connection_lock log.debug('Acquiring lock: %s' % lock) lock.acquire() + internal_lock = self.euslisp.euslime_internal_connection_lock + log.debug('Acquiring lock: %s' % internal_lock) + internal_lock.acquire() yield [Symbol(":write-string"), "Loading file: %s ...\n" % filename] try: cmd = '(slime::load-file-and-tags "{0}")'.format(qstr(filename)) @@ -566,9 +571,12 @@ def swank_load_file(self, filename): yield [Symbol(":write-string"), "Loaded.\n"] yield EuslispResult(res) lock.release() + internal_lock.release() except AbortEvaluation as e: if lock.locked(): lock.release() + if internal_lock.locked(): + internal_lock.release() log.info('Aborting evaluation...') # Force-print the message, which is # by default only displayed on the minibuffer @@ -580,6 +588,8 @@ def swank_load_file(self, filename): except Exception: if lock.locked(): lock.release() + if internal_lock.locked(): + internal_lock.release() raise def swank_inspect_current_condition(self):