mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
更加严格的lib&model定义
This commit is contained in:
1 parent
76b001305d
commit
cd3a426ef8
8 files changed
+42
-9
No files matched your search
@@ -7,8 +7,10 @@ import pslist from 'ps-list';
|
||||
import { argv } from 'yargs';
|
||||
import { builtinModel } from './common';
|
||||
import { Entry } from '../loader';
|
||||
import { Logger } from '../logger';
|
||||
import * as bus from '../service/bus';
|
||||
|
||||
const logger = new Logger('entry/master');
|
||||
const tmpdir = path.resolve(os.tmpdir(), 'hydro');
|
||||
const lockfile = path.resolve(tmpdir, 'lock.json');
|
||||
|
||||
@@ -19,7 +21,7 @@ export async function load(call: Entry) {
|
||||
const file = require(lockfile);
|
||||
const plist = await pslist();
|
||||
if (file.pid && plist.map((i) => i.pid).includes(file.pid)) {
|
||||
console.error(`Lockfile exists, pid=${file.pid}`);
|
||||
logger.error(`Lockfile exists, pid=${file.pid}`);
|
||||
process.exit(1);
|
||||
}
|
||||
} catch {
|
||||
@@ -37,9 +39,9 @@ export async function load(call: Entry) {
|
||||
require('../error');
|
||||
const config = require('../options')();
|
||||
if (!config) {
|
||||
console.log('Starting setup');
|
||||
logger.info('Starting setup');
|
||||
await call({ entry: 'setup', newProcess: true }).catch((err) => {
|
||||
console.error('Cannot start setup process.', err);
|
||||
logger.error('Cannot start setup process.', err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user