Hello!
I was trying to redirect shell command output using rake's #sh, or #ruby. Documentation told me, that semantics is the same as Kernel#exec has (and it is the same as Kernel#spawn). So I tried to use:
ruby('-e', 'puts "hello world"', out: './tst.out' )
But actually semantic differs: FileUtils#sh removes the last argument to check its :verbose and :noop keys, so it removes redirection keys. I found a solution, which is not much more difficult:
ruby('-e', 'puts "hello world"', {out: './tst.out'}, {})
I'm not sure if it is possible and reasonable to fix behavior at a moment, but I think it's worth being noted in a documentation. Redirection to a file is a very common task when you rewrite bash scripts into rake, so an example would be very useful.
Also I'd appreciate if you describe how sh with separate ARGV arguments can be used for piping several commands.