mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: enhanced pm2 detection
This commit is contained in:
1 parent
0562661fb4
commit
2f2b1ca711
5 files changed
+24
-9
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
const PATH = process.env.PATH?.split(':') || [];
|
||||
|
||||
// @ts-ignore
|
||||
const pm2: typeof import('pm2') | null = (() => {
|
||||
for (const dir of PATH) {
|
||||
try {
|
||||
const info = fs.readlinkSync(path.resolve(dir, 'pm2'));
|
||||
const p = path.resolve(dir, info);
|
||||
return require(`${p.split('.bin')[0]}pm2`); // eslint-disable-line import/no-dynamic-require
|
||||
} catch (e) { }
|
||||
}
|
||||
return null;
|
||||
})();
|
||||
|
||||
export default pm2;
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/utils",
|
||||
"version": "1.3.6",
|
||||
"version": "1.3.7",
|
||||
"description": "hydrooj utils",
|
||||
"main": "package.json",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
Reference in new issue
Block a user