
8

Handle paths with spaces when editing credentials by ghiculescu · Pull Request #...
source link: https://github.com/rails/rails/pull/42728
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

The build is now failing due to this test:
test "edit command does not overwrite by default if credentials already exists" do
run_edit_command(editor: "eval echo api_key: abc >")
assert_match(/api_key: abc/, run_show_command)
run_edit_command
assert_match(/api_key: abc/, run_show_command)
end
Specifically, the first editor command is a partial command string, not an executable. I didn't think of it before, but we do need to support ENV["EDITOR"]
values that include arguments (e.g. "subl -w"
). We could use Shellwords.split
for that (i.e. system(*Shellwords.split(ENV["EDITOR"]), tmp_path.to_s)
), but that won't work with the >
in the test command. At this point, we're probably better off just using Shellwords.escape
like you had before. Sorry for the noise.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK