@@ -1153,14 +1153,15 @@ def subprocess_shell(self, protocol_factory, cmd, *, stdin=subprocess.PIPE,
1153
1153
if bufsize != 0 :
1154
1154
raise ValueError ("bufsize must be 0" )
1155
1155
protocol = protocol_factory ()
1156
+ debug_log = None
1156
1157
if self ._debug :
1157
1158
# don't log parameters: they may contain sensitive information
1158
1159
# (password) and may be too long
1159
1160
debug_log = 'run shell command %r' % cmd
1160
1161
self ._log_subprocess (debug_log , stdin , stdout , stderr )
1161
1162
transport = yield from self ._make_subprocess_transport (
1162
1163
protocol , cmd , True , stdin , stdout , stderr , bufsize , ** kwargs )
1163
- if self ._debug :
1164
+ if self ._debug and debug_log is not None :
1164
1165
logger .info ('%s: %r' , debug_log , transport )
1165
1166
return transport , protocol
1166
1167
@@ -1182,6 +1183,7 @@ def subprocess_exec(self, protocol_factory, program, *args,
1182
1183
"a bytes or text string, not %s"
1183
1184
% type (arg ).__name__ )
1184
1185
protocol = protocol_factory ()
1186
+ debug_log = None
1185
1187
if self ._debug :
1186
1188
# don't log parameters: they may contain sensitive information
1187
1189
# (password) and may be too long
@@ -1190,7 +1192,7 @@ def subprocess_exec(self, protocol_factory, program, *args,
1190
1192
transport = yield from self ._make_subprocess_transport (
1191
1193
protocol , popen_args , False , stdin , stdout , stderr ,
1192
1194
bufsize , ** kwargs )
1193
- if self ._debug :
1195
+ if self ._debug and debug_log is not None :
1194
1196
logger .info ('%s: %r' , debug_log , transport )
1195
1197
return transport , protocol
1196
1198
0 commit comments