mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-26 16:01:45 -07:00
Fix sh not seeing errors for command before the pipe
sh is missing the pipefail flag. We must use bash for this.
This commit is contained in:
parent
4f85e37520
commit
9716a4d588
1 changed files with 2 additions and 2 deletions
|
@ -423,12 +423,12 @@ def db_dump(module, host, user, password, db_name, target, all_databases, port,
|
||||||
path = module.get_bin_path('xz', True)
|
path = module.get_bin_path('xz', True)
|
||||||
|
|
||||||
if path:
|
if path:
|
||||||
cmd = '%s | %s > %s' % (cmd, path, shlex_quote(target))
|
cmd = 'set -o pipefail && %s | %s > %s' % (cmd, path, shlex_quote(target))
|
||||||
else:
|
else:
|
||||||
cmd += " > %s" % shlex_quote(target)
|
cmd += " > %s" % shlex_quote(target)
|
||||||
|
|
||||||
executed_commands.append(cmd)
|
executed_commands.append(cmd)
|
||||||
rc, stdout, stderr = module.run_command(cmd, use_unsafe_shell=True)
|
rc, stdout, stderr = module.run_command(cmd, use_unsafe_shell=True, executable='bash')
|
||||||
return rc, stdout, stderr
|
return rc, stdout, stderr
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue