process fire and forget?

M

Michael Ulm

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

Thanks,

Michael

--
Michael Ulm
R&D Team
ISIS Information Systems Austria
tel: +43 2236 27551-219, fax: +43 2236 21081
e-mail: (e-mail address removed)
Visit our Website: www.isis-papyrus.com
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: process fire and forget?"

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

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top