Skip to content

refactor: raw spawn call to instead of helper.spawn in start non-daemon mode - #23

Merged
popomore merged 5 commits into
eggjs:masterfrom
NBUT-Developers:refactor-start-spawn
Aug 9, 2018
Merged

refactor: raw spawn call to instead of helper.spawn in start non-daemon mode#23
popomore merged 5 commits into
eggjs:masterfrom
NBUT-Developers:refactor-start-spawn

Conversation

@XadillaX

@XadillaXXadillaX commented Aug 7, 2018

Copy link
Copy Markdown
Member
Checklist
  • npm test passes
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

@XadillaX
XadillaX requested a review from atian25August 7, 2018 08:41
@XadillaX
XadillaXforce-pushed the refactor-start-spawn branch from 0f0c0b8 to 21c120bCompareAugust 7, 2018 08:44
@atian25
atian25 requested a review from popomoreAugust 7, 2018 08:46
Comment threadlib/cmd/start.js
} else {
// signal event had been handler at common-bin helper
this.helper.spawn('node', eggArgs, options);
options.stdio = options.stdio || 'inherit';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这里是不是不需要这个配置了

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

原来的有什么问题?为什么不在 helper.spawn 加参数实现,而又在这里实现重复的逻辑代码?
背景问题是什么?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

@fengmk2 要暴露出 child 对象供上层监听使用。我跟天猪讨论后的方案有:

  1. 暴露出 helper 里面的 childs
  2. helper 里面年久失修,重构估计会变成 break,所以直接这一块逻辑替换。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

helper 返回 child 不行?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

helper 里面是一个 Promise,要等子进程结束后才会被 resolve

Comment threadlib/cmd/start.js

// attach master signal to child
let signal;
[ 'SIGINT', 'SIGQUIT', 'SIGTERM' ].forEach(event => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

看起来好像这个库不支持 cp.spawn()

@codecov

codecovBot commented Aug 9, 2018

Copy link
Copy Markdown

Codecov Report

Merging #23 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@## master #23 +/- ##
=====================================
Coverage 100% 100% =====================================
Files 6 6 Lines 190 203 +13 =====================================
+ Hits 190 203 +13
Impacted FilesCoverage Δ
lib/cmd/start.js100% <100%> (ø)⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22faa4c...edcca1d. Read the comment docs.

@popomore
popomore merged commit e07726c into eggjs:masterAug 9, 2018
@popomore

Copy link
Copy Markdown
Member

忘记发了,明天发

@popomore

Copy link
Copy Markdown
Member
  • egg-scripts@2.7.0

Sign up for freeto 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.

3 participants

@XadillaX@popomore@fengmk2