Skip to content

Instantly share code, notes, and snippets.

@headius
Created March 3, 2010 21:48
Show Gist options
  • Save headius/321084 to your computer and use it in GitHub Desktop.
Save headius/321084 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'spoon'
Spoon.spawnp 'jruby', *ARGV
~/projects/jruby ➔ jruby daemonize.rb -e "puts 'starting'; while true; sleep 1; puts 'still going'; end"
~/projects/jruby ➔ starting
still going
still going
still going
still going
~/projects/jruby ➔ still going
still going
still going
ps
PID TTY TIME CMD
342 ttys000 0:00.06 -bash
421 ttys000 0:00.49 /usr/bin/java -d32 -client -Djruby.memory.max=500m -Djruby.stack.max=1024k
363 ttys001 0:00.02 -bash
still going
~/projects/jruby ➔
kistill going
llstill going
still going
421still going
~/projects/jruby ➔
@zipizap
Copy link

zipizap commented Jan 29, 2016

From http://www.qnx.com/developers/docs/660/index.jsp?topic=%2Fcom.qnx.doc.neutrino.lib_ref%2Ftopic%2Fp%2Fposix_spawn.html
Description:

The posix_spawn() and posix_spawnp() functions create a new process (child process) from the specified process image. The new process image is constructed from a regular executable file called the new process image file. The difference between these two functions is only in the means by which they specify the new process image file:

posix_spawn() takes an absolute path to the executable
posix_spawnp() performs a path search for the file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment