lib/parallel_tests/tasks.rb in parallel_tests-0.16.6 vs lib/parallel_tests/tasks.rb in parallel_tests-0.16.7
- old
+ new
@@ -28,11 +28,13 @@
# - simple system "set -o pipefail" returns nil even though set -o pipefail exists with 0
def suppress_output(command, ignore_regex)
activate_pipefail = "set -o pipefail"
remove_ignored_lines = %Q{(grep -v "#{ignore_regex}" || test 1)}
- if system("#{activate_pipefail} 2>/dev/null && test 1")
- "#{activate_pipefail} && (#{command}) | #{remove_ignored_lines}"
+ if File.executable?('/bin/bash') && system('/bin/bash', '-c', "#{activate_pipefail} 2>/dev/null && test 1")
+ # We need to shell escape single quotes (' becomes '"'"') because
+ # run_in_parallel wraps command in single quotes
+ %Q{/bin/bash -c '"'"'#{activate_pipefail} && (#{command}) | #{remove_ignored_lines}'"'"'}
else
command
end
end