aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2017-02-23 18:47:23 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2017-02-23 18:47:23 +0100
commit9fdf326a5f6f7e10594dd6205cfc8e0425fb3e67 (patch)
tree5ba674c73ffb5e2f246e7a2d0a8db579733d37f5 /railties
parent72fc0b446612134fa7e5cade2c6463a34306ff68 (diff)
downloadrails-9fdf326a5f6f7e10594dd6205cfc8e0425fb3e67.tar.gz
rails-9fdf326a5f6f7e10594dd6205cfc8e0425fb3e67.tar.bz2
rails-9fdf326a5f6f7e10594dd6205cfc8e0425fb3e67.zip
Yank the intricate immediately-exiting editor recognition.
Most editors support a wait flag of some kind which prevents their process from exiting until the file or window is closed. Prefer people to assign that themselves than us mucking around with File mtimes or other such things. Example of an editor config: ``` export EDITOR="atom --wait" ```
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/commands/secrets/secrets_command.rb18
1 files changed, 2 insertions, 16 deletions
diff --git a/railties/lib/rails/commands/secrets/secrets_command.rb b/railties/lib/rails/commands/secrets/secrets_command.rb
index 05e0c228e8..3ba8c0c85b 100644
--- a/railties/lib/rails/commands/secrets/secrets_command.rb
+++ b/railties/lib/rails/commands/secrets/secrets_command.rb
@@ -21,10 +21,8 @@ module Rails
require_application_and_environment!
Rails::Secrets.read_for_editing do |tmp_path|
- watch tmp_path do
- puts "Waiting for secrets file to be saved. Abort with Ctrl-C."
- system("\$EDITOR #{tmp_path}")
- end
+ puts "Waiting for secrets file to be saved. Abort with Ctrl-C."
+ system("\$EDITOR #{tmp_path}")
end
puts "New secrets encrypted and saved."
@@ -33,18 +31,6 @@ module Rails
rescue Rails::Secrets::MissingKeyError => error
say error.message
end
-
- private
- def watch(tmp_path)
- mtime, start_time = File.mtime(tmp_path), Time.now
-
- yield
-
- editor_exits_after_open = $?.success? && (Time.now - start_time) < 1
- if editor_exits_after_open
- sleep 0.250 until File.mtime(tmp_path) != mtime
- end
- end
end
end
end