Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb9d9e56

Browse files
committed
Further improve _safer_popen_windows doc
This adjusts the formatting of the _safer_popen_windows docstringand comments, and rewords some parts for clarity and brevity.
1 parentad8190b commitb9d9e56

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

‎git/cmd.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,22 +264,19 @@ def _safer_popen_windows(
264264
creationflags=subprocess.CREATE_NO_WINDOW|subprocess.CREATE_NEW_PROCESS_GROUP
265265

266266
# When using a shell, the shell is the direct subprocess, so the variable must
267-
# be set in its environment, to affect its search behavior. (The "1" can be any
268-
# value.)
267+
# be set in its environment, to affect its search behavior.
269268
ifshell:
270-
# The original may be immutable or reused by the caller. Make changes in a
271-
# copy.
269+
# The original may be immutable, or the caller may reuse it. Mutate a copy.
272270
env= {}ifenvisNoneelsedict(env)
273-
env["NoDefaultCurrentDirectoryInExePath"]="1"
271+
env["NoDefaultCurrentDirectoryInExePath"]="1"# The "1" can be an value.
274272

275273
# When not using a shell, the current process does the search in a
276274
# CreateProcessW API call, so the variable must be set in our environment. With
277-
# a shell, this is unnecessary, in versions where
278-
# https://github.com/python/cpython/issues/101283 is patched. If that is
279-
# unpatched, then in the rare case the ComSpec environment variable is unset,
280-
# the search for the shell itself is unsafe. Setting
281-
# NoDefaultCurrentDirectoryInExePath in all cases, as is done here, is simpler
282-
# and protects against that. (As above, the "1" can be any value.)
275+
# a shell, that's unnecessary if https://github.com/python/cpython/issues/101283
276+
# is patched. In Python versions where it is unpatched, and in the rare case the
277+
# ComSpec environment variable is unset, the search for the shell itself is
278+
# unsafe. Setting NoDefaultCurrentDirectoryInExePath in all cases, as done here,
279+
# is simpler and protects against that. (As above, the "1" can be any value.)
283280
withpatch_env("NoDefaultCurrentDirectoryInExePath","1"):
284281
returnPopen(
285282
command,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp