Forum: Ruby pgrep equivalent on windows

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
05337aed68267daec2996e5ca732d476?d=identicon&s=25 Akbar Home (rinda)
on 2007-02-16 18:36
(Received via mailing list)
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.
Aee77dba395ece0a04c688b05b07cd63?d=identicon&s=25 Daniel Berger (Guest)
on 2007-02-16 19:05
(Received via mailing list)
On Feb 16, 10:32 am, "akbarhome" <akbarh...@gmail.com> wrote:
>
> 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
This topic is locked and can not be replied to.