git-cola/git-cola — pull request #252 by living180 (2014-05-08 16:54:29+00:00)
Title: Improve fork() on Windows.

The Windows implementation of `fork()`, `_fork_win32()`, had some code to try to allow commands like gitk to be executed. However, this code did not work for multiple reasons. The main issue is that on Windows, gitk is actually provided by a batch file named gitk.cmd. If the first element in the `args` list passed to `subprocess.Popen()` is simply `"gitk"`, the file won't be found and the command will fail. This could be solved by passing `shell=True` to `Popen()`, but that is not ideal. The fix provided here is to implement the same path searching algorithm that the Windows shell uses to locate an executable, taking into account the `PATHEXT` environment variable, and to use the result of that search as the first element of the `args` list for `subprocess.Popen()`.

Signed-off-by: Daniel Harding