Skip to content

Commit

Permalink
Add pipe to strings to remove non-ascii values in possible return
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolphpienaar committed Dec 5, 2023
1 parent 499fc70 commit c51186e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pypx/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,20 @@ async def systemlevel_runasync(self, opt, d_params):
opt[k] = v

if b_commandGen:
str_cmd = f_commandGen(opt)
str_cmd = f_commandGen(opt) + ' | strings '
self.dp.qprint("\n%s" % str_cmd, level = 5, type = 'status')
raw_response = await asyncio.create_subprocess_shell(
str_cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.STDOUT
stderr=asyncio.subprocess.PIPE
)
await raw_response.wait()

stdout, stderr = await raw_response.communicate()

# if only stderr and not stdout, then equate the two...
if not stdout and stderr:
stdout = stderr

d_ret = self.__formatResponseHelper(
stdout, str_cmd, raw_response.returncode
)
Expand Down Expand Up @@ -256,4 +259,5 @@ def __formatResponseHelper(self, stdout, args, returncode):
response['status'] = 'success'
response['data'] = self.parseResponse(std)

return response
return response

0 comments on commit c51186e

Please sign in to comment.