mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
自动释放锁,优化record.getList()
This commit is contained in:
1 parent
d3deeaeb96
commit
2bf6adbaa0
12 files changed
+51
-28
No files matched your search
@@ -3,6 +3,7 @@
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import pslist from 'ps-list';
|
||||
import { argv } from 'yargs';
|
||||
import { builtinModel } from './common';
|
||||
import { Entry } from '../loader';
|
||||
@@ -13,8 +14,11 @@ const lockfile = path.resolve(tmpdir, 'lock.json');
|
||||
export async function load(call: Entry) {
|
||||
if (fs.existsSync(lockfile) && !argv.ignorelock) {
|
||||
const file = require(lockfile);
|
||||
console.error(`Lockfile exists, pid=${file.pid}`);
|
||||
process.exit(1);
|
||||
const plist = await pslist();
|
||||
if (file.pid && plist.map((i) => i.pid).includes(file.pid)) {
|
||||
console.error(`Lockfile exists, pid=${file.pid}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
const context = {
|
||||
addons: global.addons,
|
||||
|
||||
Reference in new issue
Block a user