summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-08-19 09:42:34 +0900
committeraycabta <aycabta@gmail.com>2020-08-19 09:42:34 +0900
commitca6868a4305fa1ba8186c28a5b9acbe5e287f260 (patch)
tree023f5c361693653b40c977ecbc2292fbac1cc205
parentbed6b7206a64eeca5b521e02799da4055d9f5e55 (diff)
Do "write" to temp stdin before "reopen"
-rw-r--r--test/irb/test_history.rb10
1 files changed, 5 insertions, 5 deletions
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
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