-
Notifications
You must be signed in to change notification settings - Fork 631
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
wip: interactive mode #803
base: main
Are you sure you want to change the base?
Conversation
Doesn't seem to be working quite right. I'm testing by creating a new rails application off main using "rails new app -j esbuild -c tailwind", then changing the Procfile.dev to remove the remote debugger env, then doing a "rails generate scaffold post title:string", and then inserting a debugger statement in PostsController#new and then hitting that URL: It's currently swallowing inputs and the output back from the irb debugger is also a bit garbled. |
Looks like the |
Thanks! Debugging works nice with your latest commit, but input for non-interactive processes is not closed, I think it's missing something like this: jeromedalbert/foreman@interactive...input. When I try that diff, inputs are closed correctly. Tailwind watch is a particular case though, it expects a continuous stdin, otherwise it exits, through no fault of Foreman. If I use |
Hmm, even with the latest change, I can't get irb to act right. It's resetting the output, not revealing input. |
Here's what I see when running with the latest from here: There's no visible input until I hit return. And the IRB session seems to clear itself after showing results. |
@dhh Maybe you haven't rebuilt and reinstalled the gem with the latest changes, or didn't run your last command with Here are the full steps I used:
Result: |
Egg on my face! I had reset the application I was testing in, and yes, indeed it had removed the --interactive flag. This seems to work very well! What I also noticed was that while in the debugger session, I made a change to a JavaScript file, and the esbuild watch process didn't interrupt the debugging session? It just ran after I was done. That's certainly ideal! So this is awesome. Is there anything you have outstanding that you think needs to be validated before we can proceed with this path and make foreman a default for Rails 8? |
Are you talking to me or ddollar? 😅 To me it looks pretty good, again besides that tailwind thing I mentioned in #803 (comment). I don't know if it's just me or if you're having the issue as well, and probably an issue to file with tailwind, but for any other processes like solid_queue which was the impetus for all of this, I think there should be no problem. |
Hmm, once I added tailwind, I indeed started getting swallowed inputs. Was fine with esbuild, but not tailwind. Here's a video demonstrating it. In the video, I have several swallowed inputs. And then after continuing from the debugger and starting it again, it would exit and proceed on return. Need to test if this is a tailwind specific issue, in which case I'm sure we can get them to fix it with something like --watch=forever like esbuild has, or if it's also an issue with dart or the like. Screencast.from.2024-08-02.14-42-11.webm |
I think it's tailwind, if you apply my patch to foreman, so non-interactive processes are truly closed for stdin, you'll see that tailwind straight up exits because it has no more stdin. If you try my
dart worked fine for me, see rails/rails#52459 (comment), I tried dartsass, bulma, bun, esbuild, rollup, webpack and they all worked on my machine. Only tailwind and postcss (edit: and bootstrap) had issues. |
I tested If non-interactive processes are open to stdin (tested with the current state of the interactive branch at the time of writing):
If non-interactive processes are closed for stdin (tested with my branch):
So either way it works. |
Maybe @adamwathan has someone on his team who can help with this. Whatever the esbuild team did with --watch=forever, and not swallowing stdin, seems like what we need there too. |
To get a better overview, I re-tested different combinations with If non-interactive processes are open to stdin
If non-interactive processes are closed for stdin
|
Hi! Jordan from the Tailwind team here. You can pass |
Oh that's great, @thecrypticace. I just tried that, and it seemed to make the swallowing of input go away in some quick testing. But IRB itself still seems like it has some issues running like this. That seems like an easier problem for us to short, though! |
Spoke too soon. Still seeing stdin eating. But that's probably just because stdin IS open for the process. @ddollar, seems like maybe it's worth trying just closing stdin for all processes except for the interactive one. Maybe that will make the rest of the IRB weirdness go away too. |
Yeah, seems like The |
Yeah |
Unrelated: when I am in a debugger session and I type |
@thecrypticace I think we should be able to close stdin on this end. @ddollar is there a reason, generally speaking, that stdin needs to be left open for the other processes? |
Pulled in @jeromedalbert 's fix and added a few more tweaks to level out prefix injection. Things look pretty good on my end but definitely noted that |
Sorry, got away from this for a little while. What are the remaining blockers? Does it seem feasible that we'll be able to make IRB/debugger work as one would expect using this foreground process approach? |
Tested the latest. The IRB help command now displays correctly! Next stumbling block is that after you continued from one debugger break, and you hit another, "enter" will cause the debugger to continue. Instead of just doing a newline. Not sure what that is about. |
I can also reproduce the issue mentioned above by DHH.
I don't use |
This is a very nice improvement for debugging applications. Very nice idea. I did some tests locally with a brand new test app:
and worked smoothly with ruby debug Gravacao.de.Tela.2024-08-30.as.17.46.41.movI will test to replace one of my apps with this workflow and check if everything works fine with my workflow Without
|
this happened on my test as well. |
I believe this is a bug/unexpected behavior of irb itself and doesn't have anything to do with foreman. I logged an issue: ruby/irb#1002 |
👋 This is an intended behaviour of IRB's debugger integration. Quoting from my comment in ruby/irb#1002: It's related to a requested feature: ruby/irb#856 For context, this is what And IRB's |
Oh, yeah it seems like there's actually a general problem with the debug gem. Must have been recently introduced. I can now reproduce the "first debugger session, you can use return just fine, second-onward, it doesn't work" problem without foreman or overmind in the loop! This is without even entering IRB. Just staying in the rdbg session that's provided by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not received
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimism
No description provided.