diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f1c7f6..7ff3f30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - Forced source-client installs to use the native pnpm command path during install, build, and inject. - Cleared the temporary installer download folder before fetching a fresh installer. +- Fixed pnpm warnings being treated as installer failures on Windows PowerShell. +- Fixed the installer UI download path so it avoids stale loose temp scripts. ## 1.0.5 diff --git a/dist/DiscordLyrics-Installer-UI.cs b/dist/DiscordLyrics-Installer-UI.cs index f5a3029..4e5b595 100644 --- a/dist/DiscordLyrics-Installer-UI.cs +++ b/dist/DiscordLyrics-Installer-UI.cs @@ -13,6 +13,7 @@ internal static class Program [STAThread] private static void Main(string[] args) { + ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new InstallerForm(args)); @@ -431,7 +432,12 @@ private string GetInstallerPath() if (File.Exists(local)) return local; - var temp = Path.Combine(Path.GetTempPath(), "DiscordLyrics-Installer.ps1"); + var cacheDir = Path.Combine(Path.GetTempPath(), "DiscordLyricsInstaller"); + Directory.CreateDirectory(cacheDir); + var temp = Path.Combine(cacheDir, "DiscordLyrics-Installer.ps1"); + if (File.Exists(temp)) + File.Delete(temp); + using (var client = new WebClient()) client.DownloadFile("https://github.com/" + Repo + "/releases/latest/download/DiscordLyrics-Installer.ps1", temp); diff --git a/dist/DiscordLyrics-Installer.exe b/dist/DiscordLyrics-Installer.exe index 544a238..7ffca44 100644 Binary files a/dist/DiscordLyrics-Installer.exe and b/dist/DiscordLyrics-Installer.exe differ diff --git a/dist/DiscordLyrics-Installer.ps1 b/dist/DiscordLyrics-Installer.ps1 index 44788b9..478c04d 100644 --- a/dist/DiscordLyrics-Installer.ps1 +++ b/dist/DiscordLyrics-Installer.ps1 @@ -87,13 +87,26 @@ function Invoke-CheckedCommand { ) $ResolvedCommand = Resolve-NativeCommand -Command $Command - $CommandLine = Join-CommandLine -Command $ResolvedCommand -Arguments $Arguments - $Output = & cmd.exe /d /s /c $CommandLine 2>&1 - $ExitCode = $LASTEXITCODE - - $Text = ($Output | ForEach-Object { "$_" }) -join [Environment]::NewLine + $StartInfo = [System.Diagnostics.ProcessStartInfo]::new() + $StartInfo.FileName = $ResolvedCommand + $StartInfo.Arguments = ($Arguments | ForEach-Object { ConvertTo-CommandArgument $_ }) -join " " + $StartInfo.UseShellExecute = $false + $StartInfo.RedirectStandardOutput = $true + $StartInfo.RedirectStandardError = $true + $StartInfo.CreateNoWindow = $true + + $Process = [System.Diagnostics.Process]::new() + $Process.StartInfo = $StartInfo + [void]$Process.Start() + $StdOut = $Process.StandardOutput.ReadToEnd() + $StdErr = $Process.StandardError.ReadToEnd() + $Process.WaitForExit() + $ExitCode = $Process.ExitCode + $Process.Dispose() + + $Text = (@($StdOut, $StdErr) | Where-Object { $_ }) -join [Environment]::NewLine if ($Text) { - Write-Host $Text + Write-Host ($Text.TrimEnd()) } if ($ExitCode -ne 0) { diff --git a/dist/DiscordLyrics-release.zip b/dist/DiscordLyrics-release.zip index 82fae51..093f53a 100644 Binary files a/dist/DiscordLyrics-release.zip and b/dist/DiscordLyrics-release.zip differ diff --git a/scripts/DiscordLyrics-Installer-UI.cs b/scripts/DiscordLyrics-Installer-UI.cs index f5a3029..4e5b595 100644 --- a/scripts/DiscordLyrics-Installer-UI.cs +++ b/scripts/DiscordLyrics-Installer-UI.cs @@ -13,6 +13,7 @@ internal static class Program [STAThread] private static void Main(string[] args) { + ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new InstallerForm(args)); @@ -431,7 +432,12 @@ private string GetInstallerPath() if (File.Exists(local)) return local; - var temp = Path.Combine(Path.GetTempPath(), "DiscordLyrics-Installer.ps1"); + var cacheDir = Path.Combine(Path.GetTempPath(), "DiscordLyricsInstaller"); + Directory.CreateDirectory(cacheDir); + var temp = Path.Combine(cacheDir, "DiscordLyrics-Installer.ps1"); + if (File.Exists(temp)) + File.Delete(temp); + using (var client = new WebClient()) client.DownloadFile("https://github.com/" + Repo + "/releases/latest/download/DiscordLyrics-Installer.ps1", temp); diff --git a/scripts/DiscordLyrics-Installer.ps1 b/scripts/DiscordLyrics-Installer.ps1 index 44788b9..478c04d 100644 --- a/scripts/DiscordLyrics-Installer.ps1 +++ b/scripts/DiscordLyrics-Installer.ps1 @@ -87,13 +87,26 @@ function Invoke-CheckedCommand { ) $ResolvedCommand = Resolve-NativeCommand -Command $Command - $CommandLine = Join-CommandLine -Command $ResolvedCommand -Arguments $Arguments - $Output = & cmd.exe /d /s /c $CommandLine 2>&1 - $ExitCode = $LASTEXITCODE - - $Text = ($Output | ForEach-Object { "$_" }) -join [Environment]::NewLine + $StartInfo = [System.Diagnostics.ProcessStartInfo]::new() + $StartInfo.FileName = $ResolvedCommand + $StartInfo.Arguments = ($Arguments | ForEach-Object { ConvertTo-CommandArgument $_ }) -join " " + $StartInfo.UseShellExecute = $false + $StartInfo.RedirectStandardOutput = $true + $StartInfo.RedirectStandardError = $true + $StartInfo.CreateNoWindow = $true + + $Process = [System.Diagnostics.Process]::new() + $Process.StartInfo = $StartInfo + [void]$Process.Start() + $StdOut = $Process.StandardOutput.ReadToEnd() + $StdErr = $Process.StandardError.ReadToEnd() + $Process.WaitForExit() + $ExitCode = $Process.ExitCode + $Process.Dispose() + + $Text = (@($StdOut, $StdErr) | Where-Object { $_ }) -join [Environment]::NewLine if ($Text) { - Write-Host $Text + Write-Host ($Text.TrimEnd()) } if ($ExitCode -ne 0) {