Module: SGE::Utils
Instance Method Summary collapse
Instance Method Details
#execute(cmd) ⇒ Object
11 12 13 14 |
# File 'lib/sge/utils.rb', line 11 def execute(cmd) # The same as `#{cmd}` Kernel.system(cmd) end |
#mkfifo(tmp_dir) ⇒ Object
5 6 7 8 9 |
# File 'lib/sge/utils.rb', line 5 def mkfifo(tmp_dir) tmp_pipe = `mktemp -u #{File.join(tmp_dir || "/tmp","fifo.XXXX")}`.strip `mkfifo #{tmp_pipe}` tmp_pipe end |
#read_file(filename, remove_file = false) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/sge/utils.rb', line 16 def read_file(filename, remove_file = false) File.open(filename,"r") do |file| yield(file) end File.unlink(filename) if remove_file end |