From ba06a1dc1ba8cd78bdb5da42272b718560af0b9b Mon Sep 17 00:00:00 2001 From: Samuel Saez <149368351+samuelsl27@users.noreply.github.com> Date: Wed, 12 Aug 2026 15:40:22 +0000 Subject: [PATCH] =?UTF-8?q?fix(desktop):=20stop=20Task=20from=20eating=20t?= =?UTF-8?q?he=20PowerShell=20variables=20in=20jlink=E2=80=A6=20(#7258)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …:runtime The Windows branch of jlink:runtime clears the read-only attribute jlink leaves on the bundled JRE, so Tauri can overwrite the staged copies. It never worked. Task does not hand the command to cmd.exe; it runs it through its own POSIX shell, which expands `$_` and `$false` as shell variables. Neither is set, so both became empty and PowerShell was asked to run ForEach-Object { .IsReadOnly = } which errors on every file. Verified against a directory of read-only files: the double-quoted form leaves 3 of 3 still read-only and exits non-zero, the single-quoted form clears all 3 and exits 0. Single quotes stop the expansion. Also add -File: without it Get-ChildItem yields directories too, and DirectoryInfo has no IsReadOnly property, so those iterations would fail even once the variables survive. The POSIX branch above is unaffected - chmod needs no variables. # Description of Changes --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have run `task check` to verify linters, typechecks, and tests pass - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing) for more details. Co-authored-by: Claude Opus 5 (1M context) --- .taskfiles/desktop.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.taskfiles/desktop.yml b/.taskfiles/desktop.yml index 27f8dafde0..555e252a4e 100644 --- a/.taskfiles/desktop.yml +++ b/.taskfiles/desktop.yml @@ -195,7 +195,11 @@ tasks: # `desktop:build` run `jlink:clean` first to force a fresh build. - cmd: chmod -R u+w runtime/jre platforms: [linux, darwin] - - cmd: powershell -NoProfile -Command "Get-ChildItem -Recurse runtime/jre | ForEach-Object { $_.IsReadOnly = $false }" + # Single-quoted so Task's shell leaves `$_` and `$false` alone. Double + # quotes let it expand them as its own variables, and since neither is + # set the command PowerShell actually received was + # `ForEach-Object { .IsReadOnly = }`, which fails on every file. + - cmd: powershell -NoProfile -Command 'Get-ChildItem -Recurse -File runtime/jre | ForEach-Object { $_.IsReadOnly = $false }' platforms: [windows] status: - test -f runtime/jre/release