2005-04-13 11:27:09 -04:00
|
|
|
#
|
2009-03-05 22:56:38 -05:00
|
|
|
# fork.rb -
|
2009-07-07 07:36:20 -04:00
|
|
|
# $Release Version: 0.9.6 $
|
2005-04-13 11:27:09 -04:00
|
|
|
# $Revision$
|
|
|
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
|
|
|
#
|
|
|
|
# --
|
|
|
|
#
|
2009-03-05 22:56:38 -05:00
|
|
|
#
|
2005-04-13 11:27:09 -04:00
|
|
|
#
|
|
|
|
|
|
|
|
@RCS_ID='-$Id$-'
|
|
|
|
|
2002-07-09 07:17:17 -04:00
|
|
|
|
|
|
|
module IRB
|
|
|
|
module ExtendCommand
|
|
|
|
class Fork<Nop
|
|
|
|
def execute(&block)
|
2005-04-13 11:27:09 -04:00
|
|
|
pid = send ExtendCommand.irb_original_method_name("fork")
|
2009-03-05 22:56:38 -05:00
|
|
|
unless pid
|
2010-05-23 04:48:44 -04:00
|
|
|
class << self
|
2002-07-09 07:17:17 -04:00
|
|
|
alias_method :exit, ExtendCommand.irb_original_method_name('exit')
|
|
|
|
end
|
|
|
|
if iterator?
|
|
|
|
begin
|
|
|
|
yield
|
|
|
|
ensure
|
|
|
|
exit
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
pid
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|