Skip to content

Commit fe5ee66

Browse files
committed
f
1 parent 9235c39 commit fe5ee66

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

lib/cmd/start.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const sleep = require('mz-modules/sleep');
66
const homedir = require('node-homedir');
77
const utils = require('egg-utils');
88
const fs = require('mz/fs');
9-
const { exec } = require('mz/child_process');
109
const moment = require('moment');
1110
const spawn = require('child_process').spawn;
1211
const Command = require('../command');
@@ -180,22 +179,17 @@ class StartCommand extends Command {
180179
* checkStatus({ stderr, timeout }) {
181180
let count = 0;
182181
let isSuccess = true;
183-
while (true) {
184-
let stat;
182+
while (!this.isReady) {
185183
try {
186-
stat = yield fs.stat(stderr);
184+
const stat = yield fs.stat(stderr);
185+
if (stat && stat.size > 0) {
186+
this.logger.error('Start failed, see %s', stderr);
187+
isSuccess = false;
188+
break;
189+
}
187190
} catch (_) {
188191
// nothing
189192
}
190-
if (stat && stat.size > 0) {
191-
const [ stdout ] = yield exec('tail -n 100 ' + stderr);
192-
this.logger.error(stdout);
193-
this.logger.error('Start failed, see %s', stderr);
194-
isSuccess = false;
195-
break;
196-
}
197-
198-
if (this.isReady) continue;
199193

200194
if (count >= timeout) {
201195
this.logger.error('Start failed, %ds timeout', timeout);

test/start.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ describe('test/start.test.js', () => {
416416

417417
yield coffee.fork(eggBin, [ 'start', '--daemon', '--workers=1' ], { cwd })
418418
// .debug()
419-
.expect('stderr', /nodejs.Error: error message/)
420419
.expect('stderr', new RegExp(`Start failed, see ${stderr}`))
421420
.expect('code', 1)
422421
.end();

0 commit comments

Comments
 (0)