1 file changed
@@ -1189,7 +1189,12 @@ def execute( | |||
| 1189 | 1189 | ||
| 1190 | 1190 | stdout_sink = PIPE if with_stdout else getattr(subprocess, "DEVNULL", None) or open(os.devnull, "wb") | |
| 1191 | 1191 | if shell is None: | |
| 1192 | - shell = self.USE_SHELL | ||
| 1192 | + # Get the value of USE_SHELL with no deprecation warning. Do this without | ||
| 1193 | + # warnings.catch_warnings, to avoid a race condition with application code | ||
| 1194 | + # configuring warnings. The value could be looked up in type(self).__dict__ | ||
| 1195 | + # or Git.__dict__, but those can break under some circumstances. This works | ||
| 1196 | + # the same as self.USE_SHELL in more situations; see Git.__getattribute__. | ||
| 1197 | + shell = super().__getattribute__("USE_SHELL") | ||
| 1193 | 1198 | _logger.debug( | |
| 1194 | 1199 | "Popen(%s, cwd=%s, stdin=%s, shell=%s, universal_newlines=%s)", | |
| 1195 | 1200 | redacted_command, | |
0 commit comments