Skip to content

Commit e2904f3

Browse files
Merge pull request #7440 from rubygems/troubleshoot_windows_ci
Fix some flaky test failures on Windows
2 parents 2e28234 + 0cd3b6d commit e2904f3

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

bundler/spec/support/command_execution.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module Spec
4-
CommandExecution = Struct.new(:command, :working_directory, :exitstatus, :stdout, :stderr) do
4+
CommandExecution = Struct.new(:command, :working_directory, :exitstatus, :original_stdout, :original_stderr) do
55
def to_s
66
"$ #{command}"
77
end
@@ -11,6 +11,19 @@ def stdboth
1111
@stdboth ||= [stderr, stdout].join("\n").strip
1212
end
1313

14+
def stdout
15+
original_stdout
16+
end
17+
18+
# Can be removed once/if https://github.com/oneclick/rubyinstaller2/pull/369 is resolved
19+
def stderr
20+
return original_stderr unless Gem.win_platform?
21+
22+
original_stderr.split("\n").reject do |l|
23+
l.include?("operating_system_defaults")
24+
end.join("\n")
25+
end
26+
1427
def to_s_verbose
1528
[
1629
to_s,

bundler/spec/support/helpers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ def sys_exec(cmd, options = {})
193193

194194
stdout_read_thread = Thread.new { stdout.read }
195195
stderr_read_thread = Thread.new { stderr.read }
196-
command_execution.stdout = stdout_read_thread.value.strip
197-
command_execution.stderr = stderr_read_thread.value.strip
196+
command_execution.original_stdout = stdout_read_thread.value.strip
197+
command_execution.original_stderr = stderr_read_thread.value.strip
198198

199199
status = wait_thr.value
200200
command_execution.exitstatus = if status.exited?

0 commit comments

Comments
 (0)