lib/rbbt/util/cmd.rb in rbbt-util-5.26.14 vs lib/rbbt/util/cmd.rb in rbbt-util-5.26.15

- old
+ new

@@ -2,9 +2,17 @@ require 'stringio' require 'open3' module CMD + def self.gzip_pipe(file) + Open.gzip?(file) ? "<(gunzip -c '#{file}')" : "'#{file}'" + end + + def self.bash(cmd) + %Q(bash <<EOF\n#{cmd}\nEOF\n) + end + def self.process_cmd_options(options = {}) string = "" options.each do |option, value| raise "Invalid option key: #{option.inspect}" if option.to_s !~ /^[a-z_0-9\-=]+$/i raise "Invalid option value: #{value.inspect}" if value.to_s.include? "'"