Method: MakeMakefile#xsystem

Defined in:
lib/mkmf.rb

#xsystem(command, opts = nil) ⇒ Object



377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/mkmf.rb', line 377

def xsystem command, opts = nil
  varpat = /\$\((\w+)\)|\$\{(\w+)\}/
  if varpat =~ command
    vars = Hash.new {|h, k| h[k] = ENV[k]}
    command = command.dup
    nil while command.gsub!(varpat) {vars[$1||$2]}
  end
  Logging::open do
    puts command.quote
    if opts and opts[:werror]
      result = nil
      Logging.postpone do |log|
        output = IO.popen(libpath_env, command, &:read)
        result = ($?.success? and File.zero?(log.path))
        output
      end
      result
    else
      system(libpath_env, command)
    end
  end
end