scoop-nerd-fonts icon indicating copy to clipboard operation
scoop-nerd-fonts copied to clipboard

'Cascadia-Code' (2106.17) upgrade fails when fonts are in use

Open arielsalvo opened this issue 3 years ago • 4 comments

Cascadia Code installer fails to update the font files if they are already in use.

Example:

Copy-Item : The process cannot access the file 'C:\WINDOWS\Fonts\CascadiaCode.ttf' because it is being used by another process.
At line:4 char:5
+     Copy-Item $_.FullName -destination "$env:windir\Fonts"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Still, this is not detected: 'Cascadia-Code' (2108.26) was installed successfully!

Maybe change the installer to copy those on next reboot if the files are locked?

Thanks! --Ariel

arielsalvo avatar Sep 16 '21 13:09 arielsalvo

You can first remove it, then after restart the system, do a fresh install.

tan-wei avatar Sep 26 '21 13:09 tan-wei

@tan-wei That could work but probably not as you think. If you take a look at the code for the removal, lines 24 and 25, you'll see that if the files are in use it would just fail silently at removing them. Then, when you restart the system the files will be released, allowing you to overwrite them with your fresh installation. The fonts would not really be uninstalled and this would not be any better than restarting the system before attempting to upgrade the fonts.

I mean, there are plenty of workarounds but the package is not working correctly here: at the very least, the error in the installer/remover code should translate in failure to install/remove package and not silently failing and moving on.

arielsalvo avatar Sep 26 '21 19:09 arielsalvo

@abejenaru Got it. Actually, I always use this "workaround" to upgrade fonts :-(, it is not elegant.

tan-wei avatar Sep 27 '21 02:09 tan-wei

[Using shovel installer instead of scoop installer ...]

 R:\>shovel update Cascadia-Code imagemagick
 Cascadia-Code: 2108.26 -> 2110.31
 imagemagick: 7.1.0-12 -> 7.1.0-13
 Updating 2 outdated apps:
 Updating 'Cascadia-Code' (2108.26 -> 2110.31) [64bit]
 Downloading new version
 Starting download with aria2 ...
   >>> DOWNLOAD ELIDED <<<
 Download: (OK):download completed.
 Checking hash of CascadiaCode-2110.31.zip ... ok.
 Uninstalling 'Cascadia-Code' (2108.26)
 Running uninstaller script...
 The 'Cascadia-Code' font family has been uninstalled and will not be present after restarting your computer.
 Unlinking ~\scoop\apps\Cascadia-Code\current
 Installing 'Cascadia-Code' (2110.31) [64bit] [nerd-fonts]
 WARN  By installing you accept following license: OFL-1.1 (https://spdx.org/licenses/OFL-1.1.html)
 Loading CascadiaCode-2110.31.zip from cache.
 Extracting CascadiaCode-2110.31.zip ... done.
 Running installer script...
+
-ERROR The requested operation cannot be performed on a file with a user-mapped section open.

david-bakin avatar Nov 01 '21 02:11 david-bakin