• trevor (he/they)@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    2 days ago

    I don’t think it’s that simple. The challenge is that you need to still behave as if it’s invoked as the user so that the editor uses their configurations instead of simply execing it as root.

    I could be wrong though ¯\_(ツ)_/¯

    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      2
      ·
      2 days ago

      Sudo uses the setuid bit or whatever, so it still has access to the user’s environment variables and whatnot. So figuring out which editor to run shouldn’t be an issue.

      • trevor (he/they)@lemmy.blahaj.zone
        link
        fedilink
        English
        arrow-up
        4
        ·
        2 days ago

        That’s not what I mean. Yeah, getting the environment variables are simple enough, but if you simply exec something as the root user, whatever you exec will naturally be looking for configs in /root/.config and not your ~/.config dir, so any configurations to things like your text editor won’t be read.