I'm using a vim plugin which currently uses 'p4 set' to get the value of some perforce environment variables. If I edit a file as root with, for example, 'sudo vim somefile', then the plugin gripes at me and doesn't work because the output of 'p4 set' is empty. However, the actual environment variables that I assume 'p4 set' is using are available from 'sudo' context. I can demonstrate this with the following sequence:
~ » echo $P4USER nalderso ~ » sudo echo $P4USER nalderso ~ » p4 set P4CLIENT=[redacted] P4PORT=[redacted] P4USER=nalderso ~ » sudo p4 set
Is this expected? Is there an easy way to get 'sudo p4 set' to return the same values as 'p4 set'? I'm thinking of modifying the plugin to just use the environment variables directly, but then I'll have to modify my windows client to use environment variables instead of the registry.