diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6810b59..eba2be1 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -19,6 +19,7 @@ jobs: os: - ubuntu - macos + - windows ruby: - "3.2" @@ -47,4 +48,4 @@ jobs: - name: Run tests timeout-minutes: 10 - run: bundle exec bake test + run: bundle exec sus --verbose diff --git a/lib/io/stream/buffered.rb b/lib/io/stream/buffered.rb index a1660fa..ecdc342 100644 --- a/lib/io/stream/buffered.rb +++ b/lib/io/stream/buffered.rb @@ -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) @@ -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) diff --git a/test/io/stream/buffered.rb b/test/io/stream/buffered.rb index 2829fe3..f1cc41d 100644 --- a/test/io/stream/buffered.rb +++ b/test/io/stream/buffered.rb @@ -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