Skip to content

Commit ab1baa4

Browse files
author
Kuniwak
committed
User can understand why the server did not start
1 parent dcff792 commit ab1baa4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

gulp/serve.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ var serve = function() {
3030
});
3131

3232
this.stderr.on('data', function(buf) {
33-
gutil.log(gutil.colors.red(buf));
33+
var stderr = String(buf);
34+
var isAddressAlreadyInUse = Boolean(stderr.match(/EADDRINUSE/));
35+
36+
var msg = 'サーバーを起動できませんでした。\n' + (isAddressAlreadyInUse ?
37+
'既にサーバーが立ち上がっているか、8000 番ポートが既に使用されています。' : stderr);
38+
39+
gutil.log(gutil.colors.red(msg));
3440
});
3541
});
3642
};

0 commit comments

Comments
 (0)