Skip to content

Commit 034a8bb

Browse files
znzko1
authored andcommitted
Check if HOME can change or not instead of ENV["CI"]
1 parent 9d507dc commit 034a8bb

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/support/console_test_case.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,23 @@ class ConsoleTestCase < TestCase
99
warn "Tests on local and remote. You can disable remote tests with RUBY_DEBUG_TEST_NO_REMOTE=1."
1010
end
1111

12+
HOME_CANNOT_CHANGE =
13+
begin
14+
pwd = Dir.pwd
15+
ruby = ENV['RUBY'] || RbConfig.ruby
16+
home_cannot_change = false
17+
PTY.spawn({ "HOME" => pwd }, ruby, '-e', 'puts ENV["HOME"]') do |r,|
18+
home_cannot_change = r.gets.chomp != pwd
19+
end
20+
home_cannot_change
21+
end
22+
1223
class << self
1324
attr_reader :pty_home_dir
1425

1526
def startup
1627
@pty_home_dir =
17-
if ENV["CI"]
28+
if HOME_CANNOT_CHANGE
1829
# CIs usually doesn't allow overriding the HOME path
1930
# we also don't need to worry about adding or being affected by ~/.rdbgrc on CI
2031
# so we can just use the original home page there
@@ -25,7 +36,7 @@ def startup
2536
end
2637

2738
def shutdown
28-
unless ENV["CI"]
39+
unless HOME_CANNOT_CHANGE
2940
FileUtils.remove_entry @pty_home_dir
3041
end
3142
end

0 commit comments

Comments
 (0)