unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / 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: Re: using pp without require 'pp' when $DEBUG = True
Date: Thu, 16 Nov 2017 01:30:16 +0000	[thread overview]
Message-ID: <20171116013016.GA8948@starla> (raw)
In-Reply-To: <D6324CB4.7BC3E%james.robinson3@cigna.com>

"Robinson Jr, James P (Jim)      HHHH" <James.Robinson3@Cigna.com> wrote:
> This is not an issue if you run "unicorn -d config.ru², but If you
> manually set $DEBUG = true,  which I foolishly did because I didn¹t
> realize that $DEBUG was a special variable in ruby,  you get an undefined
> method error.   

Right, thanks for the bug report.

> I will be changing my code to use a different variable name, however I am
> not sure if there are valid reasons to manually set $DEBUG in ruby.  If
> there are, this may be an issue for others.

Yes, $DEBUG is a special variable in Ruby, and documented in the
ruby manpage; anybody is allowed to set it.

> I think the simplest solution would be to replace the line above with an
> if block:
> 
>       if $DEBUG
>         require 'pp'
>         pp({ :inner_app => inner_app })
>       end

Right, I'll prepare a patch tonight (gotta run out, soon) and
probably make a bugfix release in the next day or two, for this.

> Similar blocks appear in unicorn/bin/unicorn and
> unicorn/bin/unicorn_rails. I am assuming the one in unicorn/bin/unicorn
> is the one that allows it to work when using the -d flag. If there really
> is never any reason to manually set $DEBUG I¹m sorry I wasted your time.
> 
> In any case, thank you for Unicorn!

No problem!

  reply	other threads:[~2017-11-16  1:30 UTC|newest]

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 [this message]
2017-11-16 21:09   ` [PATCH] require 'pp' if $DEBUG is set by Rack app Eric Wong

Reply instructions:

You may reply publicly 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://yhbt.net/unicorn/

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

  git send-email \
    --in-reply-to=20171116013016.GA8948@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).