Daniel Berger
2/16/2007 6:00:00 PM
On Feb 16, 10:32 am, "akbarhome" <akbarh...@gmail.com> wrote:
> Hi, I have this code need to be translated to windows machine:
>
> `kill #{`pgrep -f optimize_jobs.rb`.chomp}`
> exec("ruby -C#{RAILS_ROOT}/public/files optimize_jobs.rb &") if fork
> == nil
>
> The second line has been translated successfully as:
> require "win32/process"
> exec("ruby -C#{RAILS_ROOT}/public/files optimize_jobs.rb &") if
> Process.fork == nil
>
> But what about first line? Anybody know how to translate that to
> windows machine (Windows XP Home if that matters)?
>
> Thank you.
If you're looking for a pure Ruby solution you can use sys-proctable,
and roll your own version of pgrep. Otherwise, you'll need to install
some third party tool.
Regards,
Dan