1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

better handle appending \n on stderr

fixes #39007
This commit is contained in:
Brian Coca 2018-04-19 09:45:30 -04:00 committed by Brian Coca
parent becc2a0347
commit fe5e6d74af

View file

@ -104,7 +104,10 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
(stdout, stderr) = sp.communicate()
path = to_native(path)
err = to_native(stderr or "") + "\n"
err = to_native(stderr or "")
if err and not err.endswith('\n'):
err =+ '\n'
if sp.returncode != 0:
raise AnsibleError("Inventory script (%s) had an execution error: %s " % (path, err))