Workaround issue #97 by copying cmd.exe into the temporary folder and running it from here
Hello @jorangreef There's been no activity on https://github.com/jorangreef/sudo-prompt/issues/97 or https://github.com/microsoft/terminal/issues/2419 for a year so I came up with a (quite ugly) workaround.
Since the issue is with escaping the execute.bat file path, I copy cmd.exe in the temporary folder and run it from here.
It avoids dealing with the path completely.
cmd.exe is ~274KiB so it isn't taking too long to copy.
I acknowledge this is ugly but I couldn't find anything better.
Thanks @zvin ! It's an ugly (but beautiful) hack...
It looks good, but would you please make the copy conditional on there being an ampersand in the path? This way, the common case is not affected by the copy, and we may also avoid knock-on bugs.
@zvin, perhaps it would also be good to make the copy cmd.exe branch dependent on a few more special characters, not just ampersand, e.g. see https://github.com/jorangreef/sudo-prompt/issues/119
@jorangreef Added, I hope I didn't forget any
This second commit was very wrong, it avoids copying but still runs cmd from the tmp path, I'll fix that.
PR updated @jorangreef I'd prefer merging only the first commit as it makes it less complex (not creating 2 code paths).