mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(server) crash on open error (#196)
This commit is contained in:
parent
17629f1f15
commit
49661297ab
2 changed files with 10 additions and 3 deletions
|
|
@ -217,8 +217,11 @@ function version() {
|
|||
function start(config) {
|
||||
const SERVER = DIR_SERVER + 'server';
|
||||
|
||||
if (args.server)
|
||||
require(SERVER)(config);
|
||||
if (!args.server)
|
||||
return;
|
||||
|
||||
const server = require(SERVER);
|
||||
server(config);
|
||||
}
|
||||
|
||||
function port(arg) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ const http = require('http');
|
|||
const {promisify} = require('util');
|
||||
const currify = require('currify');
|
||||
const squad = require('squad');
|
||||
const tryToCatch = require('try-to-catch');
|
||||
|
||||
const config = require(DIR_SERVER + 'config');
|
||||
|
||||
|
|
@ -62,6 +63,9 @@ module.exports = async (options) => {
|
|||
if (!config('open'))
|
||||
return;
|
||||
|
||||
opn(url);
|
||||
const [openError] = await tryToCatch(opn, url);
|
||||
|
||||
if (openError)
|
||||
exit('cloudcmd --open:', openError);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue