2005-04-13 15:27:09 +00:00
|
|
|
#
|
2009-03-06 03:56:38 +00:00
|
|
|
# fork.rb -
|
2009-07-07 11:36:20 +00:00
|
|
|
# $Release Version: 0.9.6 $
|
2005-04-13 15:27:09 +00:00
|
|
|
# $Revision$
|
|
|
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
|
|
|
#
|
|
|
|
# --
|
|
|
|
#
|
2009-03-06 03:56:38 +00:00
|
|
|
#
|
2005-04-13 15:27:09 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
@RCS_ID='-$Id$-'
|
|
|
|
|
2002-07-09 11:17:17 +00:00
|
|
|
|
|
|
|
module IRB
|
|
|
|
module ExtendCommand
|
|
|
|
class Fork<Nop
|
|
|
|
def execute(&block)
|
2005-04-13 15:27:09 +00:00
|
|
|
pid = send ExtendCommand.irb_original_method_name("fork")
|
2009-03-06 03:56:38 +00:00
|
|
|
unless pid
|
2010-05-23 08:48:44 +00:00
|
|
|
class << self
|
2002-07-09 11:17:17 +00: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
|
|
|
|
|
|
|
|
|