Method: Tap::Support::ShellUtils#redirect_sh
- Defined in:
- lib/tap/support/shell_utils.rb
#redirect_sh(cmd, path, &block) ⇒ Object
Runs the system command cmd
using sh, redirecting the output to the specified file path. Uses the redirection command:
"> \"#{path}\" 2>&1 #{cmd}"
This redirection has been tested on Windows, OS X, and Fedora. See www.robvanderwoude.com/redirection.html for pointers on redirection. The website notes that this style of redirection SHOULD NOT be used with commands that contain other redirections.
43 44 45 |
# File 'lib/tap/support/shell_utils.rb', line 43 def redirect_sh(cmd, path, &block) # :yields: ok, status sh( "> \"#{path}\" 2>&1 #{cmd}", &block) end |