Fix installer for Powershell-languageserver (#319)

- Only create the `session` directory if it doesn't exist (suppresses
  "already exists" error from `mkdir`)
- Removes path delimiter conversion (paths now stay as `\` delimited)
- Quotes all `powershell` arguments to handle whitespace in paths (this
  uses CMD syntax for `Command` and Powershell syntax for the remainder
of the line. This is because everything past the Command argument is
interpreted by Powershell, but not before or during the parsing of
`-Command` itself)
This commit is contained in:
Dominic Della Valle
2020-10-09 09:10:13 -04:00
committed by GitHub
parent d308754ef6
commit 78539e17f2

View File

@@ -5,7 +5,7 @@ set VERSION=2.1.0
curl -L -o PowerShellEditorServices.zip "https://github.com/PowerShell/PowerShellEditorServices/releases/download/v%VERSION%/PowerShellEditorServices.zip"
call "%~dp0\run_unzip.cmd" PowerShellEditorServices.zip
del PowerShellEditorServices.zip
mkdir %~dp0session
if not exist "%~dp0session" mkdir "%~dp0session"
echo @echo off^
@@ -15,6 +15,6 @@ set PSES_BUNDLE_PATH=%%~dp0PowerShellEditorServices^
set SESSION_TEMP_PATH=%%~dp0session^
powershell -NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command "%%PSES_BUNDLE_PATH:\=/%%/PowerShellEditorServices/Start-EditorServices.ps1 -BundledModulesPath %%PSES_BUNDLE_PATH:\=/%% -LogPath %%SESSION_TEMP_PATH:\=/%%/logs.log -SessionDetailsPath %%SESSION_TEMP_PATH:\=/%%/session.json -FeatureFlags @() -AdditionalModules @() -HostName 'My Client' -HostProfileId 'myclient' -HostVersion 1.0.0 -Stdio -LogLevel Normal"^
powershell -NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command ^"%%PSES_BUNDLE_PATH: =` %%\PowerShellEditorServices\Start-EditorServices.ps1^" -BundledModulesPath '%%PSES_BUNDLE_PATH%%' -LogPath '%%SESSION_TEMP_PATH%%\logs.log' -SessionDetailsPath '%%SESSION_TEMP_PATH%%\session.json' -FeatureFlags @() -AdditionalModules @() -HostName 'My Client' -HostProfileId 'myclient' -HostVersion 1.0.0 -Stdio -LogLevel Normal^
> powershell-languageserver.cmd