Alternate implementations of system() and backticks `` on Windows for ruby-1.8 and earlier.
# File lib/rake/alt_system.rb, line 97 97: def backticks(cmd) 98: kernel_backticks(repair_command(cmd)) 99: end
# File lib/rake/alt_system.rb, line 70 70: def find_runnable(file) 71: if file =~ RUNNABLE_PATTERN 72: file 73: else 74: RUNNABLE_EXTS.each { |ext| 75: if File.exist?(test = "#{file}.#{ext}") 76: return test 77: end 78: } 79: nil 80: end 81: end
# File lib/rake/alt_system.rb, line 50 50: def repair_command(cmd) 51: "call " + ( 52: if cmd =~ %\A\s*\".*?\"! 53: # already quoted 54: cmd 55: elsif match = cmd.match(%\A\s*(\S+)!) 56: if match[1] =~ %/! 57: # avoid x/y.bat interpretation as x with option /y 58: %"#{match[1]}"! + match.post_match 59: else 60: # a shell command will fail if quoted 61: cmd 62: end 63: else 64: # empty or whitespace 65: cmd 66: end 67: ) 68: end
# File lib/rake/alt_system.rb, line 83 83: def system(cmd, *args) 84: repaired = ( 85: if args.empty? 86: [repair_command(cmd)] 87: elsif runnable = find_runnable(cmd) 88: [File.expand_path(runnable), *args] 89: else 90: # non-existent file 91: [cmd, *args] 92: end 93: ) 94: kernel_system(*repaired) 95: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.