diff options
Diffstat (limited to 'lib/gitlab/encrypted_command_base.rb')
-rw-r--r-- | lib/gitlab/encrypted_command_base.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/encrypted_command_base.rb b/lib/gitlab/encrypted_command_base.rb index 679d9d8e31a..5e483fa2b15 100644 --- a/lib/gitlab/encrypted_command_base.rb +++ b/lib/gitlab/encrypted_command_base.rb @@ -41,7 +41,11 @@ module Gitlab encrypted.change do |contents| contents = encrypted_file_template unless File.exist?(encrypted.content_path) File.write(temp_file.path, contents) - system(ENV['EDITOR'], temp_file.path) + + edit_success = system(*editor_args, temp_file.path) + + raise "Unable to run $EDITOR: #{editor_args}" unless edit_success + changes = File.read(temp_file.path) contents_changed = contents != changes validate_contents(changes) @@ -99,6 +103,10 @@ module Gitlab def encrypted_file_template raise NotImplementedError end + + def editor_args + ENV['EDITOR']&.split + end end end end |