Imported File#ftype spec from rubyspecs.
[rbx.git] / lib / irb / cmd / fork.rb
blob7333e089fe3aac84a589537e9d32bc545ed0a27b
2 #   fork.rb - 
3 #       $Release Version: 0.9.5 $
4 #       $Revision: 11708 $
5 #       $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
6 #       by Keiju ISHITSUKA(keiju@ruby-lang.org)
8 # --
10 #   
13 @RCS_ID='-$Id: fork.rb 11708 2007-02-12 23:01:19Z shyouhei $-'
16 module IRB
17   module ExtendCommand
18     class Fork<Nop
19       def execute(&block)
20         pid = send ExtendCommand.irb_original_method_name("fork")
21         unless pid 
22           class<<self
23             alias_method :exit, ExtendCommand.irb_original_method_name('exit')
24           end
25           if iterator?
26             begin
27               yield
28             ensure
29               exit
30             end
31           end
32         end
33         pid
34       end
35     end
36   end
37 end