Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,14 +1153,15 @@ def subprocess_shell(self, protocol_factory, cmd, *, stdin=subprocess.PIPE,
if bufsize != 0:
raise ValueError("bufsize must be 0")
protocol = protocol_factory()
debug_log = None
if self._debug:
# don't log parameters: they may contain sensitive information
# (password) and may be too long
debug_log = 'run shell command %r' % cmd
self._log_subprocess(debug_log, stdin, stdout, stderr)
transport = yield from self._make_subprocess_transport(
protocol, cmd, True, stdin, stdout, stderr, bufsize, **kwargs)
if self._debug:
if self._debug and debug_log is not None:
logger.info('%s: %r', debug_log, transport)
return transport, protocol

Expand All @@ -1182,6 +1183,7 @@ def subprocess_exec(self, protocol_factory, program, *args,
"a bytes or text string, not %s"
% type(arg).__name__)
protocol = protocol_factory()
debug_log = None
if self._debug:
# don't log parameters: they may contain sensitive information
# (password) and may be too long
Expand All @@ -1190,7 +1192,7 @@ def subprocess_exec(self, protocol_factory, program, *args,
transport = yield from self._make_subprocess_transport(
protocol, popen_args, False, stdin, stdout, stderr,
bufsize, **kwargs)
if self._debug:
if self._debug and debug_log is not None:
logger.info('%s: %r', debug_log, transport)
return transport, protocol

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid race condition with debug logging