unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
From: Eric Wong <e@80x24.org>
To: "Robinson Jr, James P (Jim)      HHHH" <James.Robinson3@Cigna.com>
Cc: unicorn-public@bogomips.org
Subject: [PATCH] require 'pp' if $DEBUG is set by Rack app
Date: Thu, 16 Nov 2017 21:09:50 +0000
Message-ID: <20171116210949.GA11690@starla> (raw)
In-Reply-To: <20171116013016.GA8948@starla>

While "unicorn -d" requires 'pp' when setting $DEBUG, we did not
account for (rare) Rack applications setting $DEBUG at load time.

Thanks-to: James P (Jim) Robinson Jr <James.Robinson3@Cigna.com>
---
 lib/unicorn.rb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index 4bd7bda..e7bc9ce 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -59,7 +59,10 @@ def self.builder(ru, op)
         Object.const_get(File.basename(ru, '.rb').capitalize)
       end
 
-      pp({ :inner_app => inner_app }) if $DEBUG
+      if $DEBUG
+        require 'pp'
+        pp({ :inner_app => inner_app })
+      end
 
       return inner_app if no_default_middleware
 
-- 
EW

      reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16  0:57 using pp without require 'pp' when $DEBUG = True Robinson Jr, James P (Jim)      HHHH
2017-11-16  1:30 ` Eric Wong
2017-11-16 21:09   ` Eric Wong [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://bogomips.org/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171116210949.GA11690@starla \
    --to=e@80x24.org \
    --cc=James.Robinson3@Cigna.com \
    --cc=unicorn-public@bogomips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://bogomips.org/unicorn-public
	git clone --mirror http://ou63pmih66umazou.onion/unicorn-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.unicorn

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox