[PATCH 1 of 2] win32: spawndetached returns pid of detached process and not of cmd.exe

Adrian Buehlmann adrian at cadifra.com
Tue Feb 11 16:50:29 CST 2014

On 2014-02-11 23:06, Simon Heimberg wrote:
> --On 2014-02-11 22:09 +0900 Yuya Nishihara <yuya at tcha.org> wrote:
>> On Mon, 10 Feb 2014 20:08:01 +0100, Mads Kiilerich wrote:
>>> On 02/10/2014 06:02 PM, Simon Heimberg wrote:
>>>> I would recommend to the user to use the kill command that the system
>>>> provides. (`kill PID` on linux, `taskkill /pid PID` or the task
>>>> manager on windows, ...)
>>> Sure - if taskkill works and is reliable now. I guess few users are
>>> aware of taskkill. It should probably be mentioned in hg help serve -
>>> together with kill for unix-ish systems.
>>> Still, it would also be nice to have a cross platform way to terminate
>>> the daemon we started. Something that not only sent the signal, but also
>>> waited for the process to actually terminate...
>> IIRC, Windows has equivalent for `kill -KILL`, but not for `kill -SIGINT`.
>> `GenerateConsoleCtrlEvent(CTRL_C_EVENT)` only works if receiver processes
>> shares the same console.
>> http://msdn.microsoft.com/en-us/library/windows/desktop/ms683155(v=vs.85)
>> .aspx
>> It seems `taskkill` sends WM_CLOSE message if `/F` option isn't specified,
>> but hg has no message loop.
> I'm playing around with handling the return value of 
> kernel32.TerminateProcess and with 
> kernel32.WaitForSingleObject(processHandle, timeout). But it's not yet 
> ready.

It's nice that you are working on this.

Perhaps you will find some old remarks helpful:


In particular the ones from Matt there.

(just in case you haven't seen that old thread)

I'm too far away from these kind of things to help here. I just
remembered that we had some discussions in the past. Good luck!

More information about the Mercurial-devel mailing list