简体   繁体   English

使用“rails server”命令后如何使用相同的终端窗口?

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

Okay here's my problem. 好的,这是我的问题。 I type in "rails s" and then my terminal won't let me type in any commands. 我输入“rails s”,然后我的终端不会让我输入任何命令。 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. 另一方面,我可以键入“rails s -d”进行分离,然后在需要时停止服务器会很痛苦。 (Instead of using control+c, I have to find the PID and use kill -9 PID) (而不是使用control + c,我必须找到PID并使用kill -9 PID)

I'm not a professional, so if anyone has any advice it would be much appreciated, thank you! 我不是专业人士,所以如果有人有任何建议,我将不胜感激,谢谢!

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. 但是,我使用Iterm2 ,它允许我在一个窗口中打开多个终端窗口,通过拆分我的iTerm2窗口或创建多个选项卡。 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. 这样我就可以让持有rails服务器的终端和我的development.log尾部非常小,除非它们发生了一些有趣的事情。

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 :) 我使用屏幕,你也可以使用TMUX,但它们是终端的窗口管理器,你可以在同一个终端窗口创建多个窗口:)

Read up on them at WikiVS as that might help you :) http://www.wikivs.com/wiki/Screen_vs_tmux 在WikiVS上阅读它们,因为这可能对你有帮助:) http://www.wikivs.com/wiki/Screen_vs_tmux

Screen: http://www.gnu.org/software/screen/ TMUX: http://tmux.sourceforge.net/ 屏幕: 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. 显然,您无法使用运行轨道服务器的EXACT相同窗口,但它足够接近而无需搜索PID。

You can type: rails s & . 您可以输入: rails s & I'm not sure if this is what you meant. 我不确定这是不是你的意思。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 'rails server'命令无法在终端中运行 - 'rails server' command not working in terminal 取消暂停在不同终端 window 中暂停的 Rails 服务器 - Unpause a rails server that was paused in a different terminal window 在操作电缆后使用rails restart命令破坏Rails服务器 - Rails server broken after Action Cable and using rails restart command 无法使用终端命令“rails s -b $IP -p $port”在cloud9中启动rails服务器 - unable to start rails server in cloud9 using terminal command “rails s -b $IP -p $port” 如果我只能在执行Rails服务器后在其他终端中键入命令行? - If I only can type command lines in other Terminal after execute rails server? 运行Rails服务器后终端无法工作 - Terminal does not work after running rails server 尝试使用Rails服务器后在终端中获取错误 - Geting error in Terminal after trying Rails server 使用gem install安装后无法使用“ rails”命令 - Can't use 'rails' command after installing using gem install 在Windows上启动Rails服务器后如何重新获得对命令提示符的控制 - How to regain control of the command prompt after starting a Rails server on Windows 如何将 rails server 命令作为在重启或粉碎后重新启动的守护进程启动? - How to start rails server command as daemon that relaunch after reboot or crush?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM