mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Clean code, fd.close not required since open as fd if used; remove get_redirected_output from cleanup_redirection_tempfiles since output is not used
(cherry picked from commit ef51f00bbc9f24485915040b863c9d034d3c272c)
This commit is contained in:
parent
f66c74915c
commit
901bc2cffe
1 changed files with 2 additions and 3 deletions
|
@ -511,8 +511,8 @@ def make_redirection_tempfiles():
|
||||||
|
|
||||||
|
|
||||||
def cleanup_redirection_tempfiles(out_name, err_name):
|
def cleanup_redirection_tempfiles(out_name, err_name):
|
||||||
get_redirected_output(out_name)
|
for i in [out_name, err_name]:
|
||||||
get_redirected_output(err_name)
|
os.remove(i)
|
||||||
|
|
||||||
|
|
||||||
def get_redirected_output(path_name):
|
def get_redirected_output(path_name):
|
||||||
|
@ -522,7 +522,6 @@ def get_redirected_output(path_name):
|
||||||
# strip terminal format/color chars
|
# strip terminal format/color chars
|
||||||
new_line = re.sub(r'\x1b\[.+m', '', line)
|
new_line = re.sub(r'\x1b\[.+m', '', line)
|
||||||
output.append(new_line)
|
output.append(new_line)
|
||||||
fd.close()
|
|
||||||
os.remove(path_name)
|
os.remove(path_name)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue