<commit_before>require 'guard'
require 'guard/guard'
require 'spoon'
require 'socket'
require 'timeout'

module Guard
  class Shotgun < Guard
    VALID_ARGS = %w{server host port env daemonize pid option}

    autoload :Notifier, 'guard/shotgun/notifier'
    attr_accessor :pid

    STARTUP_TIMEOUT = 10 # seconds

    def initialize(watchers=[], options={})
      super
      @options = {
        host: 'localhost',
        port: 9292,
        server: "WEBrick"
      }.update(options) { |key, oldval, newval| (newval.nil? || newval.empty?) ? oldval : newval }
      @reloaded = false
    end

    # =================
    # = Guard methods =
    # =================

    # Call once when guard starts
    def start
      UI.info "Starting up Rack..."
      if running?
        UI.error "Another instance of Rack is running."
        false
      else
        @pid = Spoon.spawnp 'rackup', *options_array, config_file
      end
      wait_for_port
      if running?
        Notifier.notify(@reloaded ? 'reloaded' : 'up')
        @reloaded = false
      else
        UI.info "Rack failed to start."
        Notifier.notify('failed')
      end
    end
<commit_msg>Fixed that Spoon.spawnp fails when Guard::Shotgun#config_file is nil<commit_after>require 'guard'
require 'guard/guard'
require 'spoon'
require 'socket'
require 'timeout'

module Guard
  class Shotgun < Guard
    VALID_ARGS = %w{server host port env daemonize pid option}

    autoload :Notifier, 'guard/shotgun/notifier'
    attr_accessor :pid

    STARTUP_TIMEOUT = 10 # seconds

    def initialize(watchers=[], options={})
      super
      @options = {
        host: 'localhost',
        port: 9292,
        server: "WEBrick"
      }.update(options) { |key, oldval, newval| (newval.nil? || newval.empty?) ? oldval : newval }
      @reloaded = false
    end

    # =================
    # = Guard methods =
    # =================

    # Call once when guard starts
    def start
      UI.info "Starting up Rack..."
      if running?
        UI.error "Another instance of Rack is running."
        false
      else
        @pid = Spoon.spawnp 'rackup', *(options_array << (config_file if config_file)).reject(&:nil?)
      end
      wait_for_port
      if running?
        Notifier.notify(@reloaded ? 'reloaded' : 'up')
        @reloaded = false
      else
        UI.info "Rack failed to start."
        Notifier.notify('failed')
      end
    end

{'fraction_non_alphanumeric': 0.13220058019063408, 'fraction_numerical': 0.004973062577704103, 'mean_word_length': 2.3952180028129395, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2444447', 'n_tokens_mistral': 766, 'n_tokens_neox': 733, 'n_words': 209}