mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #48533 from terminalmage/sh-beacon
Fix UnicodeDecodeError in sh beacon
This commit is contained in:
commit
260da0d545
1 changed files with 3 additions and 2 deletions
|
@ -11,6 +11,7 @@ import time
|
|||
|
||||
# Import salt libs
|
||||
import salt.utils.path
|
||||
import salt.utils.stringutils
|
||||
import salt.utils.vt
|
||||
|
||||
__virtualname__ = 'sh'
|
||||
|
@ -81,14 +82,14 @@ def beacon(config):
|
|||
stream_stdout=False,
|
||||
stream_stderr=False)
|
||||
__context__[pkey][pid]['user'] = ps_out[pid].get('user')
|
||||
for pid in __context__[pkey]:
|
||||
for pid in list(__context__[pkey]):
|
||||
out = ''
|
||||
err = ''
|
||||
while __context__[pkey][pid]['vt'].has_unread_data:
|
||||
tout, terr = __context__[pkey][pid]['vt'].recv()
|
||||
if not terr:
|
||||
break
|
||||
out += tout
|
||||
out += salt.utils.stringutils.to_unicode(tout or '')
|
||||
err += terr
|
||||
for line in err.split('\n'):
|
||||
event = {'args': [],
|
||||
|
|
Loading…
Add table
Reference in a new issue