Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PNG_REGEX = Regexp.new(".*png")
- path = File.expand_path("..")
- print "PATH = #{path}\n"
- d = Dir.new("#{path}/") #Open all png images
- def is_png?(folder, filename)
- return PNG_REGEX.match?(filename)
- end
- print "Running processes: ", Process.groups.to_s
- d.each { |file|
- if(is_png?(path, file))
- puts "Opening... #{file}"
- opened_process = IO.popen("open -g -n \"#{path}/#{file}\"")
- print "Parent is #{Process.pid}"
- print "Child is #{opened_process.pid}" #This changes after
- # calling "open"... Not sure how to get new pid
- in_str = gets #Simulate getting some input
- # Close opened file after gets finishes (How??)
- Process.kill("TERM", opened_process.pid)
- end
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement