Skip to content

Commit

Permalink
fix(pip): don't delete server directory on installation error
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl committed Oct 17, 2023
1 parent fb75101 commit 9af5e7c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions st3/lsp_utils/server_pip_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def python_version(self) -> str:
def binary_path(self) -> str:
return self.server_binary()

def get_status(self) -> int:
return self._status

def needs_installation(self) -> bool:
if not path.exists(self.server_binary()) or not path.exists(self.pip_binary()):
return True
Expand Down Expand Up @@ -100,10 +103,7 @@ def install_or_update(self) -> None:
self.run(self.pip_binary(), 'install', '-r', dest_requirements_txt_path, '--disable-pip-version-check')
with open(self.python_version(), 'w') as f:
f.write(self.run(self._python_binary, '--version'))
except Exception:
shutil.rmtree(self.basedir(), ignore_errors=True)
raise
except Exception as error:
self._status = ServerStatus.ERROR
raise Exception('Error installing the server:\n{}'.format(error))
self._status = ServerStatus.READY

def get_status(self) -> int:
return self._status

0 comments on commit 9af5e7c

Please sign in to comment.