Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > process fire and forget?

Thread Tools

process fire and forget?

Michael Ulm
Posts: n/a
Is there a ruby way of firing up a process and then
forget about it?

I have a program that processes some data, and sometimes
forks off a process that creates a file from part of the
data. I want then to automatically open a text editor on
that file. Rubys involvement with the file stops there.
However, making just a system call to start the editor
lets the thread hang around until the user closes the
editor. This seems a bit of a waste of resources.

I need a platform independent solution btw, since this
should run (at least) on three different hardware/OS



Michael Ulm
R&D Team
ISIS Information Systems Austria
tel: +43 2236 27551-219, fax: +43 2236 21081
e-mail: Removed)
Visit our Website:

Reply With Quote
Yukihiro Matsumoto
Posts: n/a

In message "Re: process fire and forget?"
on Mon, 29 Nov 2004 18:14:30 +0900, Michael Ulm <(E-Mail Removed)> writes:

|Is there a ruby way of firing up a process and then
|forget about it?

--------------------------------------------------------- Process#detach
Process.detach(pid) => thread
Some operating systems retain the status of terminated child
processes until the parent collects that status (normally using
some variant of +wait()+. If the parent never collects this status,
the child stays around as a _zombie_ process. +Process::detach+
prevents this by setting up a separate Ruby thread whose sole job
is to reap the status of the process _pid_ when it terminates. Use
+detach+ only when you do not intent to explicitly wait for the
child to terminate. +detach+ only checks the status periodically
(currently once each second).

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fire with fire Little Green Eyed Dragon Digital Photography 0 08-16-2006 12:15 AM
On fighting fire with fire... Python 16 08-01-2005 07:09 PM