[Ruby] Launching script/runner from within Rails

ben wiseley wiseleyb at gmail.com
Thu Feb 8 11:58:46 PST 2007


You can shell out using the ` (tick under the tilde key)

we use this to validate image file formats... like so:

    file_formats = ["JPEG","PNG","GIF","TIFF","PC bitmap"]
    res = `file #{filename}`
    file_formats.each do |ff|
      if res.include?(ff)
        return
      end
    end

so you should be able to use that on script runner type stuff.

This isn't async though - which is what you need, right?  Fire and forget?

-ben


On 2/8/07, Dan Harms <zintavision at gmail.com> wrote:
>
> Is it possible to launch a process ala script/runner from within
> Rails?  Or
> any other way to launch multiple background threads.  Yes, I know
> BackgroundRb is a possibility, just wondering what other options are out
> there.
>
> - Dan Harms
> _______________________________________________
> Ruby at zenspider.com - Seattle.rb non-commercial list
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby
>


More information about the Ruby mailing list