Puppet: System Administration Automated

Support

Ticket #565: exec_hacking_01.patch

File exec_hacking_01.patch, 1.5 kB (added by mccune, 2 years ago)

NOT WORKING: Passes utiltest.rb, avoids zombie, doesn't fix the problem, still blocks at f.read.

  • lib/puppet/util.rb

    old new  
    293293         
    294294        @@os ||= Facter.value(:operatingsystem) 
    295295        output = nil 
     296        require 'rubygems' 
     297        require 'ruby-debug' 
     298        Debugger.start 
    296299        IO.popen("-") do |f| 
    297300            if f 
     301                # debugger 
    298302                output = f.read 
    299303            else 
    300304                begin 
    301                     $stdin.reopen("/dev/null") 
     305                    # $stdin.reopen("/dev/null") 
    302306                    $stderr.close 
    303307                    $stderr = $stdout.dup 
    304308                    if gid 
     
    309313                        Process.euid = uid 
    310314                        Process.uid = uid unless @@os == "Darwin" 
    311315                    end 
    312                     if command.is_a?(Array) 
    313                         Kernel.exec(*command) 
    314                     else 
    315                         Kernel.exec(command) 
     316                    Kernel.fork do 
     317                      if command.is_a?(Array) 
     318                          Kernel.exec(*command) 
     319                      else 
     320                          Kernel.exec(command) 
     321                      end 
    316322                    end 
     323                    Process.wait 
     324                    $stdout.close 
     325                    exit!($?.exitstatus) 
    317326                rescue => detail 
    318327                    puts detail.to_s 
    319328                    exit!(1)