mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 09:33:59 +02:00
* include/ruby/io.h, io.c: reverted r21709.
* ruby.c (load_file_internal): nothing to read if EOF reached while reading shebang. [ruby-core:30910] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c69fda5e2a
commit
1f1937111d
5 changed files with 43 additions and 22 deletions
|
@ -414,4 +414,28 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
ensure
|
||||
t.close(true) if t
|
||||
end
|
||||
|
||||
def test_script_from_stdin
|
||||
begin
|
||||
require 'pty'
|
||||
require 'io/console'
|
||||
rescue LoadError
|
||||
return
|
||||
end
|
||||
require 'timeout'
|
||||
result = nil
|
||||
PTY.spawn(EnvUtil.rubybin) do |s, m|
|
||||
m.print("\C-d")
|
||||
assert_nothing_raised('[ruby-dev:37798]') do
|
||||
Timeout.timeout(3) {s.read}
|
||||
end
|
||||
end
|
||||
PTY.spawn(EnvUtil.rubybin) do |s, m|
|
||||
m.print("$stdin.read; p $stdin.gets\n\C-d")
|
||||
m.print("abc\n\C-d")
|
||||
m.print("zzz\n")
|
||||
result = s.read
|
||||
end
|
||||
assert_match(/zzz\r\n"zzz\\n"\r\n\z/, result, '[ruby-core:30910]')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue