lib/runnable.rb in runnable-0.2.1 vs lib/runnable.rb in runnable-0.2.2

- old
+ new

@@ -127,15 +127,22 @@ # Create pipes to redirect Standar I/O out_rd, out_wr = IO.pipe # Redirect Error I/O err_rd, err_wr = IO.pipe - - @pid = Process.spawn( "#{@command} #{@input.join( " " )} \ - #{@options} #{@command_line_interface.parse} \ - #{@output.join( " " )}", { :out => out_wr, :err => err_wr } ) + + # Set up the command line + command = [] + command << @command + command << @input.join( " " ) + command << @options + command << @command_line_interface.parse + command << @output.join( " " ) + command = command.join( " " ) + @pid = Process.spawn( command, { :out => out_wr, :err => err_wr } ) + # Include instance in class variable @@processes[@pid] = self # Prepare the process info file to be read file_status = File.open( "/proc/#{@pid}/status" ).read.split( "\n" ) @@ -427,11 +434,13 @@ # forcing method misssing to be called. # @param [Hash] hash Parameters to be expand and included in command execution # @return [nil] def parse_hash( hash ) hash.each do |key, value| - # Call to a undefined method which trigger overwritten method_missing - # unless its named as a runnable method - self.public_send( key.to_sym, value ) unless self.respond_to?( key.to_sym ) + # Add the param parsed to command_line_interface + @command_line_interface.add_param( + key.to_s, + value != nil ? value.to_s : nil + ) end end end