Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
jobs:
- job: Windows
pool:
vmImage: 'vs2017-win2016'
steps:
- template: azure-pipelines/steps.yml
41 changes: 41 additions & 0 deletions azure-pipelines/rbreadline.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git a/rbreadline.rb b/rbreadline.rb
index c710961..e35408c 100644
--- a/rbreadline.rb
+++ b/rbreadline.rb
@@ -16,6 +16,7 @@ end

module RbReadline
require 'etc'
+ require 'io/console'

RL_LIBRARY_VERSION = "5.2"
RL_READLINE_VERSION = 0x0502
@@ -1092,6 +1093,9 @@ module RbReadline
@current_readline_init_include_level = 0
@current_readline_init_lineno = 0

+ # Used in windows
+ @is_pipe = false
+
ENV["HOME"] ||= "#{ENV["HOMEDRIVE"]}#{ENV["HOMEPATH"]}"
if !File.directory? ENV["HOME"]
raise RuntimeError.new("HOME environment variable (or HOMEDRIVE and HOMEPATH) must be set and point to a directory")
@@ -4490,6 +4494,10 @@ module RbReadline
end

def rl_getc(stream)
+ # below added as test for whether we're connected to a pipe or a keyboard.
+ # Pipe connection is probably running under a test suite.
+ return (stream.getc || EOF rescue EOF) if @is_pipe
+
while (@kbhit.Call == 0)
# If there is no input, yield the processor for other threads
sleep(@_keyboard_input_timeout)
@@ -4740,6 +4748,7 @@ module RbReadline
def readline_internal_charloop()
lastc = -1
eof_found = false
+ @is_pipe = (!@rl_outstream.winsize rescue true)

while (!@rl_done)
lk = @_rl_last_command_was_kill
39 changes: 39 additions & 0 deletions azure-pipelines/steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
steps:

- task: UseRubyVersion@0
inputs:
versionSpec: '= 2.4'

- script: |
ruby -v
ridk version
displayName: 'ruby -v + ridk version'

- script: |
mkdir tmp
cd tmp
mkdir home
displayName: 'work around readline crash (for https://github.com/bundler/bundler/issues/6902)'

- script: |
git apply --ignore-space-change --ignore-whitespace azure-pipelines\rbreadline.diff --directory=C:/hostedtoolcache/windows/Ruby/2.4.3/x64/lib/ruby/site_ruby --unsafe-paths
displayName: 'patch local readline implementation (for https://github.com/bundler/bundler/issues/6907)'

- script: |
ruby bin/rake spec:deps
displayName: 'ruby bin/rake spec:deps'

- script: |
gem install --no-document --conservative rspec_junit_formatter
displayName: 'gem install rspec_junit_formatter'

- script: |
ruby -r rspec_junit_formatter bin/rspec --format progress --format RspecJunitFormatter -o rspec/bundler-junit-results.xml || exit 0
displayName: 'ruby bin/rspec'

- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: rspec/bundler-junit-results.xml
displayName: Publish test results
condition: succeededOrFailed()
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module Gem

$debug = false

Spec::Manpages.setup
Spec::Manpages.setup unless Gem.win_platform?
Spec::Rubygems.setup
FileUtils.rm_rf(Spec::Path.gem_repo1)
ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.spec_dir}/support/hax.rb"
Expand Down