# File lib/eventmachine.rb, line 1184
1184:   def self.popen cmd, handler=nil, *args
1185:     klass = if (handler and handler.is_a?(Class))
1186:       raise ArgumentError, 'must provide module or subclass of EventMachine::Connection' unless Connection > handler
1187:       handler
1188:     else
1189:       Class.new( Connection ) {handler and include handler}
1190:     end
1191: 
1192:     w = Shellwords::shellwords( cmd )
1193:     w.unshift( w.first ) if w.first
1194:     s = invoke_popen( w )
1195:     c = klass.new s, *args
1196:     @conns[s] = c
1197:     yield(c) if block_given?
1198:     c
1199:   end