From ceb87cb7cdacd27344302700bfb0a3e68958cdae Mon Sep 17 00:00:00 2001 From: Andrew Barnes Date: Mon, 30 Mar 2026 19:31:21 -0400 Subject: [PATCH] fix: swapped error message args, dead code after check=True, missing dotnet v9 (#1250) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. ls_process.py: swapped values in error message — was reporting "read {expected} of {actual}" instead of "read {actual} of {expected}" 2. common.py: check=True made the returncode != 0 branch unreachable (CalledProcessError raised before it). Removed check=True so the warning logs execute before raising the exception explicitly. 3. ls_utils.py: dotnet version error message listed "4, 6, 7, 8" but the code also checks for version 9. Added 9 to the message. --- src/solidlsp/language_servers/common.py | 8 +++----- src/solidlsp/ls_process.py | 2 +- src/solidlsp/ls_utils.py | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/solidlsp/language_servers/common.py b/src/solidlsp/language_servers/common.py index a651de70..da814f78 100644 --- a/src/solidlsp/language_servers/common.py +++ b/src/solidlsp/language_servers/common.py @@ -117,7 +117,7 @@ class RuntimeDependencyCollection: completed_process = subprocess.run( command, shell=True, - check=True, + check=False, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -126,10 +126,8 @@ class RuntimeDependencyCollection: if completed_process.returncode != 0: log.warning("Command '%s' failed with return code %d", command, completed_process.returncode) log.warning("Command output:\n%s", completed_process.stdout) - else: - log.info( - "Command completed successfully", - ) + raise subprocess.CalledProcessError(completed_process.returncode, command, completed_process.stdout) + log.info("Command completed successfully") @staticmethod def _install_from_url(dep: RuntimeDependency, target_dir: str) -> None: diff --git a/src/solidlsp/ls_process.py b/src/solidlsp/ls_process.py index f90f7a44..6b979a92 100644 --- a/src/solidlsp/ls_process.py +++ b/src/solidlsp/ls_process.py @@ -321,7 +321,7 @@ class LanguageServerProcess: if not chunk: if process.poll() is not None: raise LanguageServerTerminatedException( - f"Process terminated while trying to read response (read {num_bytes} of {len(data)} bytes before termination)", + f"Process terminated while trying to read response (read {len(data)} of {num_bytes} bytes before termination)", language=self.language, ) # Process still running but no data available yet, retry after a short delay diff --git a/src/solidlsp/ls_utils.py b/src/solidlsp/ls_utils.py index 1dad11f3..9db2a9a4 100644 --- a/src/solidlsp/ls_utils.py +++ b/src/solidlsp/ls_utils.py @@ -549,7 +549,7 @@ class PlatformUtils: # If no supported version found, raise exception with all available versions raise SolidLSPException( - f"No supported dotnet version found. Available versions: {', '.join(available_version_cmd_output)}. Supported versions: 4, 6, 7, 8" + f"No supported dotnet version found. Available versions: {', '.join(available_version_cmd_output)}. Supported versions: 4, 6, 7, 8, 9" ) except (FileNotFoundError, subprocess.CalledProcessError): try: