[Python-Dev] 3.5 release schedule PEP

Steve Dower Steve.Dower at microsoft.com
Thu Sep 25 19:13:25 CEST 2014


> Paul Moore wrote:
> On 25 September 2014 17:05, Steve Dower <Steve.Dower at microsoft.com> wrote:
>> So yes, pip can certainly do this, and if it's already running
>> elevated then it shouldn't reprompt, but it's not entirely trivial to
>> get this right ("are you denied write access to that directory because
>> you're not admin or because it's on read-only media?") and it's
>> considerably easier to try it, fail on access issues, but provide a
>> flag for the user to force elevation. "pip --sudo install ..." would
>> be fine by me :)
> 
> I thought one issue with running an elevated command line subprocess from a
> non-elevated one, was that the elevated one didn't have access to the
> non-elevated console, so it popped up its own independent console window, which
> disappeared immediately the process completed (hence losing any error messages).
> I definitely recall easy_install did that at one stage, and it was a real pain.
> Or is that something the parent process can affect, and the cmd/easy_install
> pair just didn't do so?

I'm not sure you can do it automatically, but if you own both sides of the application you can set up a pipe between the two processes and let the unelevated side forward stdio.

Again, this isn't trivial to get right. The design for the elevation model seems to have focused mainly on GUI rather than console, probably assuming that people who need to elevate from the console will elevate the shell itself (this is a guess - I have no insight into how the Windows team designed this), so there are limitations we have to work within.

> Paul


More information about the Python-Dev mailing list