Skip to content

lsp-fsharp: failure when installing client #3022

@Tarmil

Description

@Tarmil

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command
emacs -q -l lsp-start-plain.el

where lsp-start-plain.el can be downloaded here.

Bug description

On a Windows system that has an unzip command in the PATH, the fsautocomplete client doesn't install properly.

Steps to reproduce

On Windows:

  • Put unzip.exe somewhere in the PATH.
  • Try to install lsp-fsharp.

Expected behavior

fsautocomplete installs properly.

Which Language Server did you use?

lsp-fsharp

OS

Windows

Error callstack

Contacting host: api.github.com:443
Contacting host: github.com:443
Wrote c:/Users/LDENUZ~1/AppData/Local/Temp/fsautocompleterj0Xsa.zip
The syntax of the command is incorrect.
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet-c:/Users/ldenuziere/.emacs.d/.cache/lsp/fsautocomplete/fsautocomplete.dll does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

Anything else?

The problem is that when unzip is present, the install function assumes that it's on a Unix system and runs a command intended for sh; but on Windows, it is misinterpreted by cmd. A possible fix would be to switch the conditions here to use powershell in priority if present:

(unzip-script (cond ((executable-find "unzip") (format "mkdir -p %s && unzip -qq %s -d %s" install-dir-full temp-file install-dir-full))
((executable-find "powershell") (format "powershell -noprofile -noninteractive -nologo -ex bypass Expand-Archive -path '%s' -dest '%s'" temp-file install-dir-full))
(t (user-error (format "Unable to unzip server - file %s cannot be extracted, please extract it manually" temp-file)))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions