停止Rails服务器时,Guard进程不会被杀死

时间:2017-10-08 10:04:58

标签: ruby-on-rails guard

我正在使用Procfile

中的binstub开始守卫
guard: bin/guard start

当我运行时,服务器防护工作正常,但当我终止它(ctrl-c)时出现问题。

使用ps aux | grep ruby我可以看到ruby进程仍在运行,我的粉丝旋转,我需要手动终止进程(使用kill -9 PID

username     25929 100.0  0.4  2533980  31340 s000  R     3:35AM   0:29.36 ruby /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/bin/_guard-core start
username     25904   0.0  0.1  2474800   5112 s000  S     3:35AM   0:00.23 ruby bin/guard start

杀死进程后,我可以在日志中找到此错误消息

11:51:06 AM guard.1 |  /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/bin/guard:49:in `exit'                                                
11:51:06 AM guard.1 |  : no implicit conversion from nil to integer (TypeError)
11:51:06 AM guard.1 |   from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/bin/guard:49:in `exit_with'
11:51:06 AM guard.1 |   from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/bin/guard:105:in `block in auto_restart'
11:51:06 AM guard.1 |   from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/bin/guard:103:in `loop'
11:51:06 AM guard.1 |   from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/bin/guard:103:in `auto_restart'
11:51:06 AM guard.1 |   from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/bin/guard:114:in `<top (required)>'
11:51:06 AM guard.1 |   from bin/guard:17:in `load'
11:51:06 AM guard.1 |   from bin/guard:17:in `<main>'
11:51:06 AM guard.1 Exited with exit code 1

非常感谢解决此问题的任何帮助,每次我需要重新启动服务器时都必须终止该进程。

1 个答案:

答案 0 :(得分:0)

而不是 guard:bin / guard start 在proc文件中使用guard:guard。