Sha256: d67dce71cf28448d17ebee69c9c999dcedb6731080c92fd41eaf75e390141a4b

Contents?: true

Size: 614 Bytes

Versions: 8

Compression:

Stored size: 614 Bytes

Contents

require 'shellwords'

module Eye::Process::Validate

  class Error < Exception; end

  def validate(config)
    if (str = config[:start_command])
      # it should parse with Shellwords and not raise
      spl = Shellwords.shellwords(str) * '#'

      if config[:daemonize]
        if spl =~ %r[sh#\-c|#&&#|;#]
          raise Error, "#{config[:name]}, start_command in daemonize not supported shell concats like '&&'"
        end
      end
    end

    Shellwords.shellwords(config[:stop_command]) if config[:stop_command]
    Shellwords.shellwords(config[:restart_command]) if config[:restart_command]
  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
reel-eye-0.3.1 lib/eye/process/validate.rb
eye-0.3.1 lib/eye/process/validate.rb
eye-0.3 lib/eye/process/validate.rb
eye-0.2.4 lib/eye/process/validate.rb
eye-0.2.3 lib/eye/process/validate.rb
eye-0.2.2 lib/eye/process/validate.rb
eye-0.2.1 lib/eye/process/validate.rb
eye-0.2 lib/eye/process/validate.rb