Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use native Windows commands instead of msys2 #9506

Merged
merged 5 commits into from
Jan 12, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/spec_guards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- ruby-3.0
- ruby-3.1
- ruby-3.2
- ruby-3.3
# - ruby-3.3

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand Down
3 changes: 3 additions & 0 deletions spec/ruby/core/file/atime_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
else
File.atime(__FILE__).usec.should == 0
end
rescue Errno::ENOENT => e
# Native Windows don't have stat command.
skip e.message
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions spec/ruby/core/file/ctime_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
else
File.ctime(__FILE__).usec.should == 0
end
rescue Errno::ENOENT => e
# Windows don't have stat command.
skip e.message
end
end

Expand Down
3 changes: 3 additions & 0 deletions spec/ruby/core/file/mtime_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
else
File.mtime(__FILE__).usec.should == 0
end
rescue Errno::ENOENT => e
# Windows don't have stat command.
skip e.message
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion spec/ruby/core/io/close_read_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
describe "IO#close_read" do

before :each do
@io = IO.popen 'cat', "r+"
cmd = platform_is(:windows) ? 'rem' : 'cat'
@io = IO.popen cmd, "r+"
@path = tmp('io.close.txt')
end

Expand Down
14 changes: 9 additions & 5 deletions spec/ruby/core/io/close_write_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

describe "IO#close_write" do
before :each do
@io = IO.popen 'cat', 'r+'
cmd = platform_is(:windows) ? 'rem' : 'cat'
@io = IO.popen cmd, 'r+'
@path = tmp('io.close.txt')
end

Expand Down Expand Up @@ -48,12 +49,15 @@
io.should.closed?
end

it "flushes and closes the write stream" do
@io.puts '12345'
# Windows didn't have command like cat
platform_is_not :windows do
it "flushes and closes the write stream" do
@io.puts '12345'

@io.close_write
@io.close_write

@io.read.should == "12345\n"
@io.read.should == "12345\n"
end
end

it "does nothing on closed stream" do
Expand Down
6 changes: 4 additions & 2 deletions spec/ruby/core/io/lineno_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
end

it "raises an IOError on a duplexed stream with the read side closed" do
IO.popen('cat', 'r+') do |p|
cmd = platform_is(:windows) ? 'rem' : 'cat'
IO.popen(cmd, 'r+') do |p|
p.close_read
-> { p.lineno }.should raise_error(IOError)
end
Expand Down Expand Up @@ -70,7 +71,8 @@
end

it "raises an IOError on a duplexed stream with the read side closed" do
IO.popen('cat', 'r+') do |p|
cmd = platform_is(:windows) ? 'rem' : 'cat'
IO.popen(cmd, 'r+') do |p|
p.close_read
-> { p.lineno = 0 }.should raise_error(IOError)
end
Expand Down
3 changes: 2 additions & 1 deletion spec/ruby/core/io/stat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

describe "IO#stat" do
before :each do
@io = IO.popen 'cat', "r+"
cmd = platform_is(:windows) ? 'rem' : 'cat'
@io = IO.popen cmd, "r+"
end

after :each do
Expand Down
2 changes: 1 addition & 1 deletion spec/ruby/core/kernel/require_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
features = out.lines.map { |line| File.basename(line.chomp, '.*') }

# Ignore CRuby internals
features -= %w[encdb transdb windows_1252]
features -= %w[encdb transdb windows_1252 windows_31j]
features.reject! { |feature| feature.end_with?('-fake') }

features.sort.should == provided.sort
Expand Down
3 changes: 2 additions & 1 deletion spec/ruby/core/process/waitpid_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

describe "Process.waitpid" do
it "returns nil when the process has not yet completed and WNOHANG is specified" do
pid = spawn("sleep 5")
cmd = platform_is(:windows) ? "timeout" : "sleep"
pid = spawn("#{cmd} 5")
begin
Process.waitpid(pid, Process::WNOHANG).should == nil
Process.kill("KILL", pid)
Expand Down