내가 Cucumber::Cli::Main.new(args).execute!
오이 :: CLI :: Main.new (인수) .Execute를이
그러나 루비는 다음 행으로 이동을 실행하여 오이 스크립트를 실행하고 실행이 완료된과에서 읽기 시작 때 당신은 어떻게 알 수 있습니까 파일. 그러나 오이가 처리하는 데 시간이 걸리므로 파일이 비어 있습니다. Cucumber::Cli::Main.new(args).execute!
오이가 스크립트 실행을 끝내고 HTML로 파일 채우기를 완료 할 때까지 실행을 중지하는 방법입니다. 여기
는 소스 코드에 대한 링크입니다 주셔서 감사합니다 : https://github.com/cucumber/cucumber-ruby/blob/master/lib/cucumber/cli/main.rbrequire 'cucumber'
require 'tempfile'
require 'securerandom'
filename = "#{SecureRandom.urlsafe_base64}"
file = Tempfile.new(filename)
filepath = "#{file.path}"
features = "features/login.feature"
args = features.split.concat %w(--format html --out)
args << "#{filepath}.html"
begin
Cucumber::Cli::Main.new(args).execute!
@value = file.read
ensure
file.close
file.unlink
end
편집 :
때이 상태 0
와 SystemExit없이 예외를 throw 실행
Cucumber::Cli::Main.new(args).execute!
완료 실행이 잘되었을 때 종료 코드는 0입니다.
오이 (오이)는 끝나면 항상 SystemExit 예외를 발생시킵니다. 여기
오이에 대한 소스 코드에 대한 링크입니다 : 그것은 실행의 다음 줄을 건너 뛸하지 않도록, 레일의 SystemExit없이 예외를 처리하는 방법을 https://github.com/cucumber/cucumber-ruby/blob/master/lib/cucumber/cli/main.rb.
def run
filename = "#{SecureRandom.urlsafe_base64}"
file = Tempfile.new(filename)
filepath = "#{file.path}"
features = "features/login.feature"
args = features.split.concat %w(-f html -o)
args << "#{filepath}.html"
Cucumber::Cli::Main.new(args).execute! # throws SystemExit Exception Status 0
@output = file.read
file.close
file.unlink
# More Code Below
# # # # # # # # #
end
나는 오부터 비동기이므로 아무 것도 보이지 않습니다. '실행! '차단해야합니다 – Anthony
@Anthony 오이 실행! 상태가 0 인 SystemExit를 throw하므로 예외가 발생하고 다음 줄이 실행되지 않습니다. –