From ca6868a4305fa1ba8186c28a5b9acbe5e287f260 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 19 Aug 2020 09:42:34 +0900 Subject: [PATCH] Do "write" to temp stdin before "reopen" --- test/irb/test_history.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/irb/test_history.rb b/test/irb/test_history.rb index 0b3620fe32..f9193e553a 100644 --- a/test/irb/test_history.rb +++ b/test/irb/test_history.rb @@ -116,14 +116,14 @@ module TestIRB 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