Forum: Ruby Background option like script/server -d has

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.
Daniel W. (Guest)
on 2008-11-14 01:38
Hi. I'm curious to know how I can type something like the following:

$ ruby my_program.rb

Press enter, and gain immediate control of the terminal again, as
happens when you supply the -d option when running the script/server
command from inside a Rails app.

Any ideas?
Saji N. Hameed (Guest)
on 2008-11-14 03:44
(Received via mailing list)
* Daniel W. <removed_email_address@domain.invalid> [2008-11-14 08:35:57 +0900]:

> Hi. I'm curious to know how I can type something like the following:
>
> $ ruby my_program.rb
>
> Press enter, and gain immediate control of the terminal again, as
> happens when you supply the -d option when running the script/server
> command from inside a Rails app.
>
> Any ideas?

The 'daemons' library may help
http://rubyforge.org/projects/daemons/

require 'daemons'
  Daemons.run_proc('a string for identifier') do
   ...your code
  end

saji

> --
> Posted via http://www.ruby-forum.com/.
>
>

--
Saji N. Hameed

APEC Climate Center                  +82 51 668 7470
National Pension Corporation Busan Building 12F
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 
removed_email_address@domain.invalid
KOREA
Daniel W. (Guest)
on 2008-11-17 01:25
Saji N. Hameed wrote:
> The 'daemons' library may help
> http://rubyforge.org/projects/daemons/

That's exactly what I need, thank you Saji. :)
This topic is locked and can not be replied to.