Skip to content
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

feat: expose proc #152

Merged
merged 1 commit into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/cmd/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ class DevCommand extends Command {
env: Object.assign(env, context.env),
};
debug('%s %j %j, %j', this.serverBin, devArgs, options.execArgv, options.env.NODE_ENV);
yield this.helper.forkNode(this.serverBin, devArgs, options);
const task = this.helper.forkNode(this.serverBin, devArgs, options);
this.proc = task.proc;
yield task;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"autod": "^3.1.0",
"chalk": "^2.4.2",
"co-mocha": "^1.2.2",
"common-bin": "^2.8.1",
"common-bin": "^2.9.0",
"debug": "^4.1.1",
"detect-port": "^1.3.0",
"egg-ts-helper": "^1.25.2",
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/my-egg-bin/lib/cmd/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ class MyDevCommand extends DevCommand {
// find your framework
const yadan = path.join(__dirname, '../../../custom-framework-app/node_modules/yadan');
context.argv.framework = yadan;
setTimeout(() => {
console.log('proc: %s', this.proc.pid);
}, 1000);
yield super.run(context);
}
}
Expand Down
3 changes: 2 additions & 1 deletion test/my-egg-bin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ describe('test/my-egg-bin.test.js', () => {

it('should my-egg-bin dev success', done => {
coffee.fork(eggBin, [ 'dev' ], { cwd })
// .debug()
.debug()
.expect('stdout', /yadan start/)
.expect('stdout', /proc: \d+/)
.expect('code', 0)
.end(done);
});
Expand Down