mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
cmdmod.py: Don't reset output vars inside loop
The stdout and stderr variables are used to collect the output of the command. These should not be reset inside the loop, because then the output that was already collected gets lost. Fixes: 60365
This commit is contained in:
parent
ad2b54e337
commit
8a647033a8
1 changed files with 2 additions and 4 deletions
|
@ -838,6 +838,8 @@ def _run(
|
|||
stream_stderr=True,
|
||||
)
|
||||
ret["pid"] = proc.pid
|
||||
stdout = ""
|
||||
stderr = ""
|
||||
while proc.has_unread_data:
|
||||
try:
|
||||
try:
|
||||
|
@ -848,12 +850,8 @@ def _run(
|
|||
cstdout, cstderr = "", ""
|
||||
if cstdout:
|
||||
stdout += cstdout
|
||||
else:
|
||||
stdout = ""
|
||||
if cstderr:
|
||||
stderr += cstderr
|
||||
else:
|
||||
stderr = ""
|
||||
if timeout and (time.time() > will_timeout):
|
||||
ret["stderr"] = "SALT: Timeout after {}s\n{}".format(
|
||||
timeout, stderr
|
||||
|
|
Loading…
Add table
Reference in a new issue