How to use same terminal window after using “rails server” command?

你说的曾经没有我的故事 提交于 2019-12-03 18:18:14

问题


Okay here's my problem. I type in "rails s" and then my terminal won't let me type in any commands. So I have to start a new terminal window, which is pretty annoying.

On the other hand I can type in "rails s -d" which detaches, and then it's a pain to stop the server when I need to. (Instead of using control+c, I have to find the PID and use kill -9 PID)

I'm not a professional, so if anyone has any advice it would be much appreciated, thank you!


回答1:


I don't believe there is a way to do the thing you are specifically asking for.

However, I use Iterm2 which allows me to open multiple terminal windows in one window, either by splitting my iTerm2 window or by creating multiple tabs. That way I can just make the terminals that are holding rails server and my development.log tail very small unless something interesting happens in them.




回答2:


I use screen, you can also use TMUX but they are window managers in terminal and you can create multiple windows in same terminal window :)

Read up on them at WikiVS as that might help you :) http://www.wikivs.com/wiki/Screen_vs_tmux

Screen: http://www.gnu.org/software/screen/ TMUX: http://tmux.sourceforge.net/

So you can easily switch and maintain same terminal window. You can't obviously use the EXACT same window that rails server running but it's close enough without having to do the searching for the PID.




回答3:


You can type: rails s &. I'm not sure if this is what you meant.



来源:https://stackoverflow.com/questions/10955196/how-to-use-same-terminal-window-after-using-rails-server-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!