This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 6599354  File.writable? only works if file exists...
6599354 is described below

commit 6599354ceab3161e0fec568b305aa09e4db290a6
Author: Sam Ruby <[email protected]>
AuthorDate: Wed Jun 7 13:15:40 2017 -0400

    File.writable? only works if file exists...
---
 tools/pubsub.rb | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/pubsub.rb b/tools/pubsub.rb
index c43f4cf..d8a6258 100644
--- a/tools/pubsub.rb
+++ b/tools/pubsub.rb
@@ -80,8 +80,15 @@ else
   # optionally daemonize
   Process.daemon if options.daemonize
 
+  # Determine if pidfile is writable
+  if File.exist? options.pidfile
+    writable = File.writable? options.pidfile
+  else
+    writable = File.writable? File.dirname(options.pidfile)
+  end
+
   # PID file management
-  if File.writable? options.pidfile
+  if writable
     File.write options.pidfile, Process.pid.to_s
     at_exit { File.delete options.pidfile if File.exists? options.pidfile }
   else

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to