ruby-changes:62638
From: aycabta <ko1@a...>
Date: Wed, 19 Aug 2020 09:46:11 +0900 (JST)
Subject: [ruby-changes:62638] ca6868a430 (master): Do "write" to temp stdin before "reopen"
https://git.ruby-lang.org/ruby.git/commit/?id=ca6868a430 From ca6868a4305fa1ba8186c28a5b9acbe5e287f260 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Wed, 19 Aug 2020 09:42:34 +0900 Subject: Do "write" to temp stdin before "reopen" diff --git a/test/irb/test_history.rb b/test/irb/test_history.rb index 0b3620f..f9193e5 100644 --- a/test/irb/test_history.rb +++ b/test/irb/test_history.rb @@ -116,14 +116,14 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_history.rb#L116 end with_temp_stdio do |stdin, stdout| + yield(stdin, stdout) + stdin.close + stdout.flush replace_stdio(stdin.path, stdout.path) do - yield(stdin, stdout) - stdin.close system('ruby', '-Ilib', '-Itest', '-W0', '-rirb', '-e', 'IRB.start(__FILE__)') - stdout.flush - result = stdout.read - stdout.close end + result = stdout.read + stdout.close end open(IRB.rc_file("_history"), "r") do |f| result_history = f.read -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/