mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
file.c: chardev is loadable
* file.c (ruby_is_fd_loadable): allow character devices to load, e.g., `ruby /dev/null` exits successfully. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
83c961665d
commit
081df64083
2 changed files with 6 additions and 1 deletions
2
file.c
2
file.c
|
@ -5959,7 +5959,7 @@ ruby_is_fd_loadable(int fd)
|
|||
if (S_ISREG(st.st_mode))
|
||||
return 1;
|
||||
|
||||
if (S_ISFIFO(st.st_mode))
|
||||
if (S_ISFIFO(st.st_mode) || S_ISCHR(st.st_mode))
|
||||
return -1;
|
||||
|
||||
if (S_ISDIR(st.st_mode))
|
||||
|
|
|
@ -1020,4 +1020,9 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_null_script
|
||||
skip "#{IO::NULL} is not a character device" unless File.chardev?(IO::NULL)
|
||||
assert_in_out_err([IO::NULL], success: true)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue