Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'open3'
- module ShellJob
- @queue = :default
- def self.perform(*args)
- puts "$ #{args.join(' ')}"
- Open3.popen3(*args) do |stdin, stdout, stderr|
- puts stdout.read.inspect
- end
- end
- end
- ## Queue it up
- # Resque.enqueue(ShellJob, 'which', 'cat')
- ShellJob.perform('which', 'cat')
- ## Output:
- # $ which cat
- # "/bin/cat\n"
Add Comment
Please, Sign In to add comment