Merge pull request #44910 from jonathanhefner/credentials-avoid-escaping-paths

Avoid escaping paths when editing credentials
This commit is contained in:
Jean Boussier 2022-05-09 10:11:39 +02:00 committed by GitHub
commit 38d5846e06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

@ -92,7 +92,7 @@ def ensure_credentials_have_been_added
def change_credentials_in_system_editor
credentials.change do |tmp_path|
system("#{ENV["EDITOR"]} #{Shellwords.escape(tmp_path)}")
system(*Shellwords.split(ENV["EDITOR"]), tmp_path.to_s)
end
end

@ -36,7 +36,7 @@ class Rails::Command::CredentialsCommandTest < ActiveSupport::TestCase
end
test "edit command does not overwrite by default if credentials already exists" do
run_edit_command(editor: "eval echo api_key: abc >")
run_edit_command(editor: 'ruby -e "File.write ARGV[0], %(api_key: abc)"')
assert_match(/api_key: abc/, run_show_command)
run_edit_command