Skip to content

Commit

Permalink
fix: gracefully handle read only file system (eg RunKit)
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Apr 26, 2019
1 parent f701a22 commit eeee528
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/pact/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ def create_logger
logger = ::Logger.new(log_path)
logger.level = ::Logger::DEBUG
logger
rescue Errno::EROFS
# So we can run on RunKit
logger = ::Logger.new($stdout)
logger.level = ::Logger::DEBUG
logger
end
end

Expand Down
2 changes: 2 additions & 0 deletions lib/pact/consumer_contract/pact_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def read uri, options = {}
def save_pactfile_to_tmp pact, name
::FileUtils.mkdir_p Pact.configuration.tmp_dir
::File.open(Pact.configuration.tmp_dir + "/#{name}", "w") { |file| file << pact}
rescue Errno::EROFS => e
# do nothing, probably on RunKit
end

def render_pact(uri_string, options)
Expand Down

0 comments on commit eeee528

Please sign in to comment.