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 80fe36a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 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
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 80fe36a

Please sign in to comment.