2013-02-23 118 views

回答

2
if ENV["SCREENSHOT_VIA_USB"] == "true" 
    device_args = "-s #{@serial}" if @serial 
    screenshot_cmd = "java -jar #{File.join(File.dirname(__FILE__), 'lib', 'screenShotTaker.jar')} #{path} #{device_args}" 
    log screenshot_cmd 
    raise "Could not take screenshot" unless system(screenshot_cmd) 
    else 
    begin 
     res = http("/screenshot") 
    rescue EOFError 
     raise "Could not take screenshot. App is most likely not running anymore." 
    end 
    File.open(path, 'wb') do |f| 
     f.write res 
    end 
    end 

SCREENSHOT_VIA_USB是一个环境VAR,请尝试:

export SCREENSHOT_VIA_USB=true 
相关问题