pgrep equivalent on windows

A

akbarhome

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.
 
D

Daniel Berger

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top