Conversation
it should stop with --port if start cluster with custom port number
Codecov Report
@@ Coverage Diff @@
## master #11 +/- ##
===========================================
- Coverage 100% 84.77% -15.23%
===========================================
Files 6 6
Lines 169 197 +28
===========================================
- Hits 169 167 -2
- Misses 0 30 +30
Continue to review full report at Codecov.
|
|
@atian25 add appveyor tests |
|
but |
|
I run test local all passed under win7. not support ? |
|
https://github.com/eggjs/egg-scripts/blob/master/lib/cmd/start.js#L180-L196
|
|
oh, git installed .maybe can be fixed for win32 |
stdout = stdout.split(/\n+/g).splice(0, 100);
+ this.logger.error(stdout);
+ this.logger.error('Start failed, see %s', stderr);Whether need convert stdout to string by stdout.join('\n') ? |
lib/cmd/start.js
Outdated
| break; | ||
| } else { | ||
| const str = fs.readFileSync(stderr, 'utf-8'); | ||
| let stdout = str ? str.slice(0, 50000).replace(/\r/g, '\n') : ''; |
There was a problem hiding this comment.
you can simply print all on windows
There was a problem hiding this comment.
我是参考源代码 tail 前100行,故以一行500字节*100行计算来截取 50000字节。
| } | ||
|
|
||
| const { argv } = context; | ||
| const port = argv.port || (process.env && process.env.PORT); |
There was a problem hiding this comment.
Is there other way to stop without port
There was a problem hiding this comment.
有其他方法。但相当复杂
1、修改egg-cluster, 在启动 worker 进程时,更新窗口的 title
2、在关闭服务时借助node-ffi 找到任何一个匹配 title 的 worker 窗口获取其pid
3、借助node-ffi 调用 ntdll.NtQueryInformationProcess() 方法,根据pid找到父级pid(即master进程),然后kill。
我计划实现(1, 2),并且可根据参数隐藏worker的窗口。
因为master进程没有窗口,也就无法设置其窗口 title,所以只有在 worker 上面设置了。 否则就可以跳过(3)直接找到 master 进程窗口然后 kill 之。
(3)这个 NtQueryInformationProcess 需要的 参数结构Struct极其复杂,目前搞不定。
There was a problem hiding this comment.
Or we can store port when app starts, so it’s unnecessary to give the port argument.
|
so just like Nginx `run/pid`? @popomore
发自我的 iPhone
… 在 2017年11月7日,21:19,waiting ***@***.***> 写道:
@waitingsong commented on this pull request.
In lib/cmd/stop.js:
> const { argv } = context;
+ const port = argv.port || (process.env && process.env.PORT);
能记录所有进程 pid 那当然就方便
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
https://ci.appveyor.com/project/eggjs/egg-scripts had enabled, need an empty commit to trigger it. btw, the cov is low. |
|
commit one, but seems not triggered. only master branch? |
|
try again and see, just delete and recreate it. |
lib/cmd/start.js
Outdated
| isSuccess = false; | ||
| break; | ||
| } else { | ||
| const str = fs.readFileSync(stderr, 'utf-8'); |
it should stop with --port if start cluster with custom port number
Checklist
npm testpassesAffected core subsystem(s)
Description of change