<div dir="ltr">On 17 July 2013 19:55, Steve Dower <span dir="ltr"><<a href="mailto:Steve.Dower@microsoft.com" target="_blank">Steve.Dower@microsoft.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">> I'm afraid exe files as wrappers are probably the only viable option. The basic<br>
> reason is that the OS recognises exe files in all context, with no special<br>
> configuration needed. This is not true of any other file type. So anything else<br>
> will have corner cases that will give unexpected results.<br>
<br>
</div>No reason to be afraid of this, exe wrappers are totally the best option.<br>
<br>
As for updating .exes while they're running, the best approach is to rename the running one (e.g. 'pip.exe' -> 'pip.exe.deleteme') in the same folder and either:<br>
* delete any existing .deleteme files on next run, or<br>
* delete an existing pip.exe.deleteme file immediately before trying to rename to it<br>
<br>
Any other approach will also have corner cases, but this will be the most reliable in the context of multiple users/permissions/environment variables.<br></blockquote><div><br></div><div>Cool. I'm not happy about the clutter of '.deleteme' files, and I'll still look for a way to delete them straight after the upgrade process terminates, but I may have to settle for lazy deletion.</div>
<div><br></div><div>The problem issue remaining is recognising when we need to do this. In terms of code paths, pip install -U pip is no different from (for example) pip install -U flask. But it needs to be handled specially just because it's pip. And it *doesn't* need to be handled specially if it's "python -m pip install -U pip". That's not a Windows issue, though, I was just using the Windows issue to put off having to think about it :-)</div>
<div><br></div><div>One thought, while I have a Windows expert's attention ;-) Is there a way (I'm not too bothered how complex it might be) of doing the equivalent of Unix exec in Windows? That is, start a new process and then have my initial process exit *without* the shell (or whatever started the first process) getting control back until the child completes? I'm assuming not, as otherwise solving the issue would be as easy as exec-ing "python -m pip" from the wrapper. But no harm in asking :-)</div>
<div><br></div><div>Paul</div></div></div></div>