Skip to content

Commit 215fa0d

Browse files
committed
Merge pull request #22 from kostya/master
append log if needed
2 parents 0435393 + ecb394f commit 215fa0d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/forever/base.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ class Base
66
attr_reader :started_at
77

88
def initialize(options={}, &block)
9+
@options = options
910
forking = options.delete(:fork)
1011

1112
# Run others methods
12-
options.each { |k,v| send(k, v) }
13+
options.each { |k,v| send(k, v) if respond_to?(k) }
1314

1415
instance_eval(&block)
1516

@@ -79,7 +80,7 @@ def initialize(options={}, &block)
7980

8081
File.open(pid, "w") { |f| f.write(Process.pid.to_s) } if pid
8182

82-
stream = log ? File.new(log, "w") : File.open('/dev/null', 'w')
83+
stream = log ? File.new(log, @options[:append_log] ? 'a' : 'w') : File.open('/dev/null', 'w')
8384
stream.sync = true
8485

8586
STDOUT.reopen(stream)

0 commit comments

Comments
 (0)