vscode-diff
vscode-diff copied to clipboard
[FEATURE REQUEST] Run compare as sudo
[09:18:51] Start comparing "/home/user1/tmp/image_compare" ↔ "/home/user1/tmp/image_test"
[09:18:51] Scanning "/home/user1/tmp/image_compare"
[09:18:51] Error: EACCES: permission denied, scandir '/home/user1/tmp/image_compare/root'
Error: EACCES: permission denied, scandir '/home/user1/tmp/image_compare/root'
It would be useful to have an option to run compare as sudo. In my case I need to compare two root linux files systems for debug purposes but preserving ownership/permission is important in the debug process, otherwise I would change ownership to the user running the diff. There are other ways to work around this but a "Run as sudo" options in the setting would be really useful.
It seems the relevant code is located here: https://github.com/L13/vscode-diff/blob/b8db366dde70beff47ac5507501f43568b4cd79b/src/services/%40l13/fse.ts#L197C2-L197C12
Perhaps what's suggested here will work: https://github.com/nodejs/node/issues/35765#issuecomment-714829640
"use Node's child_process to create a new sudo Node process which would request the user password (sudo-prompt module ) and then run the needed fs function e.g. fs.readdir(dirname, (dirError, names) for the specified protected directory."
Hi, you can disable "Abort On Error" in the settings. Non readable files and folders will be ignored. If this doesn't work I have to think about it.