1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix errors when XDG_CONFIG_HOME points to non-writable directory

`$HOME/.config` is not writable on CI
because I think tests should not corrupt user's data.

And GitHub Actions CI sets `XDG_CONFIG_HOME`
since `Version: 20210309.1`.

https://github.com/ruby/actions/runs/2130811016?check_suite_focus=true#step:16:301
```
Errno::EACCES: Permission denied @ dir_s_mkdir - /home/runner/.config/irb
```
This commit is contained in:
Kazuhiro NISHIYAMA 2021-03-18 15:20:41 +09:00
parent 05ebaee80e
commit e0dd072978
No known key found for this signature in database
GPG key ID: 262ED8DBB4222F7A

View file

@ -17,12 +17,14 @@ module TestIRB
Dir.chdir(@tmpdir)
@home_backup = ENV["HOME"]
ENV["HOME"] = @tmpdir
@xdg_config_home_backup = ENV.delete("XDG_CONFIG_HOME")
@default_encoding = [Encoding.default_external, Encoding.default_internal]
@stdio_encodings = [STDIN, STDOUT, STDERR].map {|io| [io.external_encoding, io.internal_encoding] }
IRB.instance_variable_get(:@CONF).clear
end
def teardown
ENV["XDG_CONFIG_HOME"] = @xdg_config_home_backup
ENV["HOME"] = @home_backup
Dir.chdir(@pwd)
FileUtils.rm_rf(@tmpdir)