Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to view stdout through console? #468

Open
joshweir opened this issue Jun 24, 2020 · 1 comment
Open

How to view stdout through console? #468

joshweir opened this issue Jun 24, 2020 · 1 comment

Comments

@joshweir
Copy link

joshweir commented Jun 24, 2020

I would like to view stdout in the better_errors console. Specifically it's much easier to view a large object via pretty_generate, for example something like this (output in irb):

>> puts JSON.pretty_generate({ foo: 'bar' })
{
  "foo": "bar"
}
=> nil

but the better_errors console does not provide stdout for puts, and JSON.pretty_generate doesn't stdout either:

>> JSON.pretty_generate({ foo: 'bar' })
=> "{\n  \"foo\": \"bar\"\n}"
>> puts JSON.pretty_generate({ foo: 'bar' })
=> nil

Is there a way to do this?

@RobinDaugherty
Copy link
Member

When a command is run through the console, the output is visible in the Rails server process output along with all of the other output.

Capturing output might be a feature we could add, but I suspect it would be difficult to redirect/replace the stdout stream. Considering that rails servers are usually multithreaded, I don't know if there's a clean way to make that work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants