Skip to content

Commit

Permalink
Add special env for testing
Browse files Browse the repository at this point in the history
See discussion in #907.
  • Loading branch information
dgutov committed Mar 22, 2024
1 parent f04a184 commit 1edfbf1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/irb/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def initialize(irb, workspace = nil, input_method = nil)
end

private def term_interactive?
return true if ENV['TEST_IRB_FORCE_INTERACTIVE']
STDIN.tty? && ENV['TERM'] != 'dumb'
end

Expand Down
4 changes: 3 additions & 1 deletion test/irb/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ def run_ruby_file(&block)
@envs["XDG_CONFIG_HOME"] ||= tmp_dir
@envs["IRBRC"] = nil unless @envs.key?("IRBRC")

PTY.spawn(@envs.merge("TERM" => "dumb"), *cmd) do |read, write, pid|
envs_for_spawn = @envs.merge('TERM' => 'dumb', 'TEST_IRB_FORCE_INTERACTIVE' => 'true')

PTY.spawn(envs_for_spawn, *cmd) do |read, write, pid|
Timeout.timeout(TIMEOUT_SEC) do
while line = safe_gets(read)
lines << line
Expand Down

0 comments on commit 1edfbf1

Please sign in to comment.