summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_silent_ui.rb
diff options
context:
space:
mode:
authorYuta Saito <kateinoigakukun@gmail.com>2022-07-16 18:21:15 +0000
committergit <svn-admin@ruby-lang.org>2022-07-17 19:44:51 +0900
commitfab8f3bde6e4d1ac78aa63e4768452b3da0f955e (patch)
tree368b86557edcfa0b983e5295c3758a7f8468fc87 /test/rubygems/test_gem_silent_ui.rb
parent5081d0dd5c366ebaee084fd67289bebe23ddb152 (diff)
downloadruby-fab8f3bde6e4d1ac78aa63e4768452b3da0f955e.tar.gz
[rubygems/rubygems] Stop using `/dev/null` for silent ui for WASI platform
WASI doesn't guarantee that `/dev/null` is present. So without this patch, we needed to mount host's `/dev` directory to WASI guest process to avoid `ENOTCAPABLE` error while `require "bundler/setup"` https://github.com/rubygems/rubygems/commit/e9187ab61f
Diffstat (limited to 'test/rubygems/test_gem_silent_ui.rb')
-rw-r--r--test/rubygems/test_gem_silent_ui.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_silent_ui.rb b/test/rubygems/test_gem_silent_ui.rb
index 355255fb48..d23d6f4cba 100644
--- a/test/rubygems/test_gem_silent_ui.rb
+++ b/test/rubygems/test_gem_silent_ui.rb
@@ -113,4 +113,10 @@ class TestGemSilentUI < Gem::TestCase
assert_empty out, 'No output'
assert_empty err, 'No output'
end
+
+ def test_new_without_dev_null
+ File.stub(:open, ->(path, mode) { raise Errno::ENOTCAPABLE if path == IO::NULL }) do
+ Gem::SilentUI.new
+ end
+ end
end