# File lib/delayed/command.rb, line 87 def daemonize # rubocop:disable PerceivedComplexity dir = @options[:pid_dir] FileUtils.mkdir_p(dir) unless File.exist?(dir) if worker_pools setup_pools elsif @options[:identifier] # rubocop:disable GuardClause if worker_count > 1 raise ArgumentError, 'Cannot specify both --number-of-workers and --identifier' else run_process("delayed_job.#{@options[:identifier]}", @options) end # rubocop:enable GuardClause else worker_count.times do |worker_index| process_name = worker_count == 1 ? 'delayed_job' : "delayed_job.#{worker_index}" run_process(process_name, @options) end end end