-
Notifications
You must be signed in to change notification settings - Fork 37
feat: support stop --title #16
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
Conversation
lib/cmd/stop.js
Outdated
@@ -32,12 +38,15 @@ class StopCommand extends Command { | |||
if (!path.isAbsolute(baseDir)) baseDir = path.join(context.cwd, baseDir); | |||
argv.baseDir = baseDir; | |||
|
|||
const pkgInfo = require(path.join(baseDir, 'package.json')); | |||
argv.title = argv.title || `egg-server-${pkgInfo.name}`; |
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.
不要默认吧,stop 应该全杀,不然改了 package name 就杀不掉进程了。
可以改成 title 不存在就不传。
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.
可以加个这个用例
改了,干掉 baseDir 的支持。 |
lib/cmd/stop.js
Outdated
|
||
// node /Users/tz/Workspaces/eggjs/egg-scripts/lib/start-cluster {"title":"egg-server","workers":4,"port":7001,"baseDir":"/Users/tz/Workspaces/eggjs/test/showcase","framework":"/Users/tz/Workspaces/eggjs/test/showcase/node_modules/egg"} | ||
let processList = yield this.helper.findNodeProcess(item => { | ||
const cmd = item.cmd; | ||
return cmd.includes('start-cluster'); | ||
return cmd.includes('start-cluster') && (!argv.title || cmd.includes(`"title":"${argv.title}"`)); |
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.
这个逻辑看着有点绕,还是先判断 title 吧
argv.title ?
cmd.includes('start-cluster') && cmd.includes(`"title":"${argv.title}"`) :
cmd.includes('start-cluster')
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.
改了,下面的也一起改了
Checklist
npm test
passesAffected core subsystem(s)
Description of change
stop baseDir
supportchange egg to 2