Commit 25f279d0 authored by ale's avatar ale

Set the 'pipefail' option on shell commands

This way we can detect failure of dump / restore commands when used
with the 'pipe' handler (when we're using shell pipes for composition).
parent bb99d517
Pipeline #3490 passed with stage
in 41 seconds
...@@ -78,7 +78,10 @@ func (s *Shell) command(ctx context.Context, arg string) *exec.Cmd { ...@@ -78,7 +78,10 @@ func (s *Shell) command(ctx context.Context, arg string) *exec.Cmd {
if s.dryRun { if s.dryRun {
args = []string{"/bin/echo", arg} args = []string{"/bin/echo", arg}
} else { } else {
args = []string{"/bin/sh", "-c", arg} // The pipefail option is necessary for us to detect
// when the first command in a pipeline fails, but we
// need bash for that.
args = []string{"/bin/bash", "-o", "pipefail", "-c", arg}
} }
if s.niceLevel != 0 { if s.niceLevel != 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment