Fix Windows context menu options not persisting across restarts#1521
Open
asiloisad wants to merge 1 commit intopulsar-edit:masterfrom
Open
Fix Windows context menu options not persisting across restarts#1521asiloisad wants to merge 1 commit intopulsar-edit:masterfrom
asiloisad wants to merge 1 commit intopulsar-edit:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When I have enable the "Show in file/folder context menus" in Settings the entries appear correctly in File Explorer's context menu but do not work at all, and checkboxes revert to unchecked after Pulsar restart.
acc. Claude:
The root cause is in how
winregv1.2.1 spawnsreg.exeinternally: it useschild_process.spawnwithshell: true, which routes the command throughcmd.exe. The registry command values written by Pulsar contain both a quoted executable path and a%1file argument placeholder. When passed throughcmd.exe, the multiple quoted groups break argument boundary parsing, and%1is expanded as a batch parameter (to an empty string). This causesreg.exeto exit with an "Invalid syntax" error, leaving thecommandsubkey created but with an empty default value. The empty command means clicking the context menu entry does nothing. On the next restart,isRegistered()performs a strict string comparison between the stored value and the expected command string, which fails because the stored value is empty, so all checkboxes appear unchecked even though the keys exist in the registry. The fix replaces the winreg-basedregister()method with directchild_process.execFilecalls usingshell: false. This passes arguments toreg.exeas a proper array without anycmd.exeprocessing, so%1is preserved literally and quoted paths are handled correctly. Reading and deregistration continue to usewinregunchanged, as those code paths are not affected by the issue.I have tested it in local build and works fine.