Same process id for exec in ruby script

70 Views Asked by At

Is there anyone know the implementation of exec by JRuby implementation.

I have two simple rubys scripts: Test.rb calls another called.rb via exec, as below:

//Test.rb
#!/usr/bin/env jruby
sleep 10
puts "hello 1 " 
exec  "./called.rb"
puts "hello 2"

//called.rb
#!/usr/bin/env jruby
puts "called a "
sleep 10
puts "called b

After executing ./test.rb, I ps java processes during execution of Test.rb and called.rb. The result is:

shijiex   6129  9987 10 22:21 pts/2    00:00:00 java -client -Djruby.memory.max=500m -Djruby.stack.max=1024k -Xmx500m -Xss1024k -Djffi.boot.library.path= -Xbootclasspath/a:/usr/lib/jruby//lib/jruby.jar -classpath : -Djruby.home=/usr/lib/jruby/ -Djruby.lib=/usr/lib/jruby//lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main ./test.rb
shijiex   6129  9987  4 22:21 pts/2    00:00:00 java -client -Djruby.memory.max=500m -Djruby.stack.max=1024k -Xmx500m -Xss1024k -Djffi.boot.library.path= -Xbootclasspath/a:/usr/lib/jruby//lib/jruby.jar -classpath : -Djruby.home=/usr/lib/jruby/ -Djruby.lib=/usr/lib/jruby//lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main ./test.rb

My understanding is that exec should invoke another Jruby process but i have not saw it. Does anyone know reason?

0

There are 0 best solutions below