Permalink
Browse files

Merge pull request #128 from richmeyers/command-normalization-fix

Enclose command in braces when normalizing it.
  • Loading branch information...
2 parents 861c6ad + 88800dd commit f57b041ab9094e95758de39af19f44ab194870fc @grahamc grahamc committed Oct 18, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/integrity/command_runner.rb
View
10 lib/integrity/command_runner.rb
@@ -40,10 +40,16 @@ def run!(command)
end
def normalize(cmd)
+ # bash requires lists to end with a semicolon (or a newline).
+ # see http://wiki.bash-hackers.org/syntax/ccmd/grouping_plain
+ # zsh has no such restriction.
+ unless cmd[-1] == ?;
+ cmd += ';'
+ end
if @dir
- "(cd #{@dir} && #{cmd} 2>&1)"
+ "cd #{@dir} && { #{cmd} } 2>&1"
else
- "(#{cmd} 2>&1)"
+ "{ #{cmd} } 2>&1"
end
end

0 comments on commit f57b041

Please sign in to comment.