Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve fork() on Windows. #252

Merged
merged 1 commit into from
May 9, 2014

Conversation

living180
Copy link
Contributor

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().

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 <dharding@living180.net>
davvid added a commit that referenced this pull request May 9, 2014
Improve fork() on Windows.

Signed-off-by: David Aguilar <davvid@gmail.com>
@davvid davvid merged commit e6b5559 into git-cola:master May 9, 2014
@living180 living180 deleted the improve_fork_on_windows branch May 9, 2014 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants