Skip to content

Instantly share code, notes, and snippets.

@brainopia
Created January 7, 2012 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brainopia/34ae5c007ab43de960e2 to your computer and use it in GitHub Desktop.
Save brainopia/34ae5c007ab43de960e2 to your computer and use it in GitHub Desktop.
fork returns pid of intermediate process of actual ruby process on linux
$ uname -a
Linux 2.6.39.1-linode34 #1 SMP Tue Jun 21 10:29:24 EDT 2011 i686 GNU/Linux
$ ruby -v
ruby 1.9.3dev (2011-07-31 revision 32789) [i686-linux]
$ ruby -e "pid = fork { exec 'ruby -e \"sleep 30\"' }; p pid"
30279
$ ps -f | grep ruby
root 30279 1 0 08:47 pts/1 00:00:00 sh -c ruby -e "sleep 30"
root 30282 30279 0 08:47 pts/1 00:00:00 ruby -e sleep 30
wtf?!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment