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

Cannot read echo when using byebug or debugger tool #703

Open
thedon-chris opened this issue Feb 27, 2018 · 12 comments
Open

Cannot read echo when using byebug or debugger tool #703

thedon-chris opened this issue Feb 27, 2018 · 12 comments

Comments

@thedon-chris
Copy link

Hello,

I am using foreman alongside a debugger tool inside of Ruby on Rails applications. Foreman is managing my puma server, redis-server, workers, and mailcatcher.

When I use a debugger tool alongside foreman, I cannot read the echo of my commands. This becomes really frustrating during the debugging process.

Can anyone please help?

@fakhir-shad
Copy link

I am also experiencing this issue. In the debugger, I am not able to see what I am typing.

@ColinTheRobot
Copy link

ColinTheRobot commented Jun 6, 2018

Yep, there's a closed issue #58 here with some old stuff about using pry-remote. But haven't been able to get it to work yet

@skyksandr
Copy link

I've faced a similar problem and looks like I've found a good workaround - https://github.com/kimmobrunfeldt/concurrently
So all you need is to write a script that feeds arguments to it.

Here is my example:
concurrently -p '[{name}]' --handle-input -n back,front -c 'black.bgGreen,black.bgCyan' 'rails s' 'bin/webpack-dev-server'

Here is how it looks like:
2018-11-20 17 21 06

PS most important flag here is --handle-input. Debugging just works

@andrewmcodes
Copy link

@thedon-chris Is this still an issue?

@b-nik
Copy link

b-nik commented Sep 5, 2019

Still an issue

@dchersey
Copy link

dchersey commented May 1, 2020

banged my head around this for a while then realized ... wait... I can just use 2 terminal tab, one for webpack-dev-server and one for rails. Duh.

@b-nik
Copy link

b-nik commented May 2, 2020

@dchersey You can also try the following if you want them on one terminal:
./bin/webpack-dev-server & bundle exec rails s && fg

You still see the output of both, with rails being the main process (so it accepts input etc in pry)

Ever since I found this I stopped bothering with foreman.

Only caveat is you need to CtrlC twice to close both programs, but it doesn't really matter.

@cesc1989
Copy link

cesc1989 commented May 4, 2020

banged my head around this for a while then realized ... wait... I can just use 2 terminal tab, one for webpack-dev-server and one for rails. Duh.

When I want to debug I usually do this. When working in normal flow, keep using Foreman.

@LoganBresnahan
Copy link

If it helps anyone here, I created a program https://github.com/LoganBresnahan/meow that utilizes GNU's fg to manage my commands and let's me run commands automatically in different terminal tabs. Foreman is a great gem and I stumbled here trying to solve my own issues with pry. My program is just shell scripts and after figuring out file descriptors pry will work.

@djpowers
Copy link

There was a solution proposed in #536 but it was ultimately not accepted. That PR cites pry/pry#1290, which I believe is the same bug being reported here.

@ddollar, would you potentially be open to reconsidering this approach? Or is there another possible solution you'd be amenable to? There seems to be a lot of demand from both pry and foreman users to figure out this problem.

@n-studio
Copy link

@ddollar mentioned that foreman wouldn't be able to figure out which process read the data from stdin. I think that a good compromise that would solve 99% of use cases would be to allow only the first process to read the stdin.

@akapitula
Copy link

I've faced a similar problem and looks like I've found a good workaround - https://github.com/kimmobrunfeldt/concurrently So all you need is to write a script that feeds arguments to it.

Here is my example: concurrently -p '[{name}]' --handle-input -n back,front -c 'black.bgGreen,black.bgCyan' 'rails s' 'bin/webpack-dev-server'

Here is how it looks like: 2018-11-20 17 21 06

PS most important flag here is --handle-input. Debugging just works

I've been struggling to have a multiprocess tool that will run from 1 docker container and the debug will work from console. After spending a lot of time searching the workaround with foreman and overmind that npm package solved it, thanks!

tvararu added a commit to nhsuk/manage-vaccinations-in-schools that referenced this issue Dec 27, 2023
`foreman` doesn't properly forward the echo of input to commands. This
means that when using the `debugger` or `binding.pry` statements in
Rails, we can't see anything that's being typed into the REPL. This
makes debugging difficult.

`concurrently` is a JS library that can be used as an alternative to
foreman.

More context: ddollar/foreman#703
tvararu added a commit to nhsuk/manage-vaccinations-in-schools that referenced this issue Dec 27, 2023
`foreman` doesn't properly forward the echo of input to commands. This
means that when using the `debugger` or `binding.pry` statements in
Rails, we can't see anything that's being typed into the REPL. This
makes debugging difficult.

`concurrently` is a JS library that can be used as an alternative to
foreman.

More context: ddollar/foreman#703
tvararu added a commit to nhsuk/manage-vaccinations-in-schools that referenced this issue Dec 27, 2023
`foreman` doesn't properly forward the echo of input to commands. This
means that when using the `debugger` or `binding.pry` statements in
Rails, we can't see anything that's being typed into the REPL. This
makes debugging difficult.

`concurrently` is a JS library that can be used as an alternative to
foreman.

More context: ddollar/foreman#703
tvararu added a commit to nhsuk/manage-vaccinations-in-schools that referenced this issue Dec 27, 2023
`foreman` doesn't properly forward the echo of input to commands. This
means that when using the `debugger` or `binding.pry` statements in
Rails, we can't see anything that's being typed into the REPL. This
makes debugging difficult.

`concurrently` is a JS library that can be used as an alternative to
foreman.

More context: ddollar/foreman#703
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