💴 Implement #2 💴

This commit is contained in:
syuilo 2016-12-30 01:35:25 +09:00 committed by Aya Morisawa
parent d6198973e2
commit 4b321ed8a3
2 changed files with 7 additions and 0 deletions

View file

@ -92,6 +92,7 @@
"gulp-uglify": "2.0.0",
"gulp-util": "3.0.8",
"inquirer": "2.0.0",
"is-root": "1.0.0",
"js-yaml": "3.7.0",
"livescript": "1.5.0",
"mime-types": "2.1.13",

View file

@ -15,6 +15,7 @@ import Logger from './utils/logger';
import * as chalk from 'chalk';
const git = require('git-last-commit');
const portUsed = require('tcp-port-used');
const isRoot = require('is-root');
import ProgressBar from './utils/cli/progressbar';
import initdb from './db/mongodb';
import checkDependencies from './utils/check-dependencies';
@ -176,6 +177,11 @@ async function init(): Promise<State> {
checkDependencies();
if (process.platform === 'linux' && !isRoot() && config.port < 1024) {
Logger.error('You need root privilages to listen on port below 1024 on Linux');
return State.failed;
}
// Check if a port is being used
if (await portUsed.check(config.port)) {
Logger.error(`Port: ${config.port} is already used!`);