[Ruby] Launching script/runner from within Rails

Dan Harms zintavision at gmail.com
Thu Feb 8 15:43:35 PST 2007


Thanks, that was exactly what I was looking for.

- Dan

On 2/8/07, Eric Hodel <drbrain at segment7.net> wrote:
>
> On Feb 8, 2007, at 11:58, ben wiseley wrote:
> > 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.
> > 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?
>
> For fire and forget, fork and exec:
>
> fork do
>    exec 'your command here'
> end
> _______________________________________________
> 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