windows code to detect if a process is still alive

Martin (gzlist) gzlist at googlemail.com
Fri Apr 15 17:02:04 UTC 2011


On 14/04/2011, Martin Pool <mbp at canonical.com> wrote:
> On 14 April 2011 17:22, Voelker, Bernhard
>>
>> I don't know too much about Python, but as (C code) fopen("file", "w")
>> locks
>> a file for others automatically on Windows, doesn't Python just use
>> that internally for locking?
>
> Good question.  The files we're talking about are not necessarily
> local.  Someone might open a repository over sftp and lose their
> connection, and then want to do something else to the same branch from
> the same client machine.  In fact, this is a good case of when stale
> locks can be left behind, because if the connection drops over sftp
> there is no possibility for the client to release its lock.

The gnuwin32 kill uses OpenProcess (as others have suggested in this
thread), and if we're putting the local pid in the remote lockfile, no
grovelling around is needed. Does seem a needlessly confusing
accommodation for dumb transports when the common case could just lock
the file.

Martin



More information about the bazaar mailing list