cmdutil: hide child window created by win32 spawndetached()
Hiding the child process window is not strictly necessary but it avoids opening
an empty shell window when running hg serve as well as a task in the task bar.
The window is hidden after the process is already started causing a single
flicker.
Find right hg command for detached process
On Windows, Mercurial can be run from the python script of from a frozen
executable. In the first case, we have to call the python interpreter since the
script is not executable. Frozen executable can be called directly.
Fix 3/3 for
issue421
cmdutil: replace unix pipe handshake with file lock
The pipe handshake cannot be implemented with Windows detached process, which
disables handle inheritance.
Fix 2/3 for
issue421
serve: add and use portable spawnvp replacement
There is no standard python command to really detach a process under Windows.
Instead we use the low level API wrapped by subprocess module with all
necessary options to avoid any kind of context inheritance. Unfortunately, this
version still opens a new window for the child process.
The following have been tried:
- os.spawnv(os.P_NOWAIT): works but the child process is killed when parent
console terminates.
- os.spawnv(os.P_DETACH): works on python25, hang on python26 when writing to
the hgweb output socket.
- subprocess.CreateProcess() hack without shell mode: similar to
os.spawnv(os.P_DETACH).
Fix 1/3 for
issue421