summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Piotrowski <piotrowski+git@gmail.com>2019-01-14 21:38:15 +0100
committerJan Piotrowski <piotrowski+git@gmail.com>2019-01-14 23:00:44 +0100
commitb51b2be11f4d53768080471b53d48d5337f617ba (patch)
treefc5c9c271b98e6c362c5909ea3cc1611266d9043
parent20c5091bc0e4e94ae3e0f57e188056b6c26fdec8 (diff)
downloadbundler-b51b2be11f4d53768080471b53d48d5337f617ba.tar.gz
patch readline in site_ruby (workaround for #6907)
-rw-r--r--azure-pipelines/rbreadline.diff41
-rw-r--r--azure-pipelines/steps.yml6
2 files changed, 46 insertions, 1 deletions
diff --git a/azure-pipelines/rbreadline.diff b/azure-pipelines/rbreadline.diff
new file mode 100644
index 0000000000..c139577610
--- /dev/null
+++ b/azure-pipelines/rbreadline.diff
@@ -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
diff --git a/azure-pipelines/steps.yml b/azure-pipelines/steps.yml
index eae79b0a6b..8c8b0c172f 100644
--- a/azure-pipelines/steps.yml
+++ b/azure-pipelines/steps.yml
@@ -13,7 +13,11 @@ steps:
mkdir tmp
cd tmp
mkdir home
- displayName: 'work around readline crash'
+ 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