Skip to content

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

Merged
merged 4 commits into from
Nov 28, 2017
Merged

feat: support stop --title #16

merged 4 commits into from
Nov 28, 2017

Conversation

atian25
Copy link
Member

@atian25 atian25 commented Nov 25, 2017

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

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}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要默认吧,stop 应该全杀,不然改了 package name 就杀不掉进程了。

可以改成 title 不存在就不传。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以加个这个用例

@atian25
Copy link
Member Author

atian25 commented Nov 28, 2017

改了,干掉 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}"`));
Copy link
Member

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')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改了,下面的也一起改了

@popomore popomore merged commit 4c41319 into master Nov 28, 2017
@popomore popomore deleted the stop-title branch November 28, 2017 10:54
@popomore
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

egg-scripts stop 支持 title 或者路径参数 请问egg-scripts1.x升级到2.x主要变化是什么?
2 participants