Skip to content

Commit

Permalink
feat: expose proc
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 committed Jul 3, 2020
1 parent 795a81b commit fcdccd7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
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

0 comments on commit fcdccd7

Please sign in to comment.