From fc3b1b7464d28a55f20c7e99a90dbf30cf54cd93 Mon Sep 17 00:00:00 2001 From: Michael Andrews Date: Wed, 25 Mar 2015 15:05:55 -0700 Subject: [PATCH] Workaround FileUtils.ln_s(src, dest, force: true) not working --- lib/masamune/environment.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/masamune/environment.rb b/lib/masamune/environment.rb index 59627c2..ccc7a1f 100644 --- a/lib/masamune/environment.rb +++ b/lib/masamune/environment.rb @@ -94,7 +94,10 @@ def logger @log_file_name = filesystem.get_path(:log_dir, log_file_template) log_file = File.open(@log_file_name, 'a') log_file.sync = true - FileUtils.ln_s(log_file, filesystem.path(:log_dir, 'latest'), force: true) + + latest = filesystem.path(:log_dir, 'latest') + FileUtils.rm(latest) if File.exists?(latest) + FileUtils.ln_s(log_file, latest) configuration.debug ? Masamune::MultiIO.new($stderr, log_file) : log_file else configuration.debug ? $stderr : nil