Skip to content
Open
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
3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
os:
- ubuntu
- macos
- windows

ruby:
- "3.2"
Expand Down Expand Up @@ -47,4 +48,4 @@ jobs:

- name: Run tests
timeout-minutes: 10
run: bundle exec bake test
run: bundle exec sus --verbose
6 changes: 5 additions & 1 deletion lib/io/stream/buffered.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ def sysclose
end
end

if RUBY_VERSION >= "3.3"
if RUBY_VERSION >= "3.3" # and RUBY_PLATFORM !~ /win32|mswin|mingw/
def syswrite(buffer)
return @io.write(buffer)
end
else
def syswrite(buffer)
raise IOError, "stream closed" if @io.closed?

while true
result = @io.write_nonblock(buffer, exception: false)

Expand All @@ -133,6 +135,8 @@ def syswrite(buffer)

# Reads data from the underlying stream as efficiently as possible.
def sysread(size, buffer)
raise IOError, "stream closed" if @io.closed?

# Come on Ruby, why couldn't this just return `nil`? EOF is not exceptional. Every file has one.
while true
result = @io.read_nonblock(size, buffer, exception: false)
Expand Down
2 changes: 2 additions & 0 deletions test/io/stream/buffered.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ def before
end

it "times out when writing" do
skip "#write with timeout not supported on Windows" if RUBY_PLATFORM =~ /win32|mswin|mingw/

server.io.timeout = 0.001

expect do
Expand Down
Loading