Skip to content

Commit

Permalink
Recursively create daemons pid directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad Scheppler committed Jan 4, 2016
1 parent 2014009 commit f3b6342
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.swp
.bundle
.DS_Store
.idea
.rvmrc
/coverage
Gemfile.lock
3 changes: 2 additions & 1 deletion lib/delayed/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
raise "You need to add gem 'daemons' to your Gemfile if you wish to use it."
end
end
require 'fileutils'
require 'optparse'
require 'pathname'

Expand Down Expand Up @@ -82,7 +83,7 @@ def initialize(args) # rubocop:disable MethodLength

def daemonize # rubocop:disable PerceivedComplexity
dir = @options[:pid_dir]
Dir.mkdir(dir) unless File.exist?(dir)
FileUtils.mkdir_p(dir) unless File.exist?(dir)

if worker_pools
setup_pools
Expand Down
3 changes: 1 addition & 2 deletions spec/delayed/command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@
describe 'running worker pools defined by multiple --pool arguments' do
it 'should run the correct worker processes' do
command = Delayed::Command.new(['--pool=*:1', '--pool=test_queue:4', '--pool=mailers,misc:2'])

expect(Dir).to receive(:mkdir).with('./tmp/pids').once
expect(FileUtils).to receive(:mkdir_p).with('./tmp/pids').once

[
['delayed_job.0', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => []}],
Expand Down

0 comments on commit f3b6342

Please sign in to comment.