Skip to content

[FEATURE REQUEST] Run compare as sudo #149

Description

@mgkwill
[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: nodejs/node#35765 (comment)

"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."

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions