omnius 1.0.726 → 1.0.727
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/update-worker.js +61 -46
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/index.js
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 38118754 bytes
|
|
4
|
+
sha256: b928e1c81c3e779a6878c091ec7cf861d00e3f1e1571356ce3c2103bbfb61701
|
package/dist/update-worker.js
CHANGED
|
@@ -295951,30 +295951,57 @@ async function waitForDaemonReady(port, expectedVersion, attempts = 24) {
|
|
|
295951
295951
|
function delay(ms) {
|
|
295952
295952
|
return new Promise((resolve10) => setTimeout(resolve10, ms));
|
|
295953
295953
|
}
|
|
295954
|
-
|
|
295955
|
-
|
|
295956
|
-
|
|
295957
|
-
|
|
295958
|
-
|
|
295959
|
-
|
|
295954
|
+
function runUtilityCommand(command, args, timeout) {
|
|
295955
|
+
return new Promise((resolve10) => {
|
|
295956
|
+
let settled = false;
|
|
295957
|
+
let stdout = "";
|
|
295958
|
+
let stderr = "";
|
|
295959
|
+
let available = true;
|
|
295960
|
+
let timer = null;
|
|
295961
|
+
const finish = (code) => {
|
|
295962
|
+
if (settled) return;
|
|
295963
|
+
settled = true;
|
|
295964
|
+
if (timer) clearTimeout(timer);
|
|
295965
|
+
resolve10({ available, code, stdout, stderr });
|
|
295966
|
+
};
|
|
295967
|
+
let child;
|
|
295968
|
+
try {
|
|
295969
|
+
child = spawn(command, args, {
|
|
295970
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
295971
|
+
windowsHide: true
|
|
295972
|
+
});
|
|
295973
|
+
} catch {
|
|
295974
|
+
resolve10({ available: false, code: null, stdout: "", stderr: "" });
|
|
295975
|
+
return;
|
|
295976
|
+
}
|
|
295977
|
+
child.stdout?.setEncoding("utf8");
|
|
295978
|
+
child.stderr?.setEncoding("utf8");
|
|
295979
|
+
child.stdout?.on("data", (chunk) => {
|
|
295980
|
+
if (stdout.length < 1024 * 1024) stdout += chunk;
|
|
295960
295981
|
});
|
|
295961
|
-
|
|
295962
|
-
|
|
295963
|
-
|
|
295964
|
-
|
|
295982
|
+
child.stderr?.on("data", (chunk) => {
|
|
295983
|
+
if (stderr.length < 1024 * 1024) stderr += chunk;
|
|
295984
|
+
});
|
|
295985
|
+
child.once("error", () => {
|
|
295986
|
+
available = false;
|
|
295987
|
+
finish(null);
|
|
295988
|
+
});
|
|
295989
|
+
child.once("close", (code) => finish(code));
|
|
295990
|
+
timer = setTimeout(() => {
|
|
295991
|
+
available = false;
|
|
295992
|
+
child.kill("SIGKILL");
|
|
295993
|
+
finish(null);
|
|
295994
|
+
}, timeout);
|
|
295995
|
+
timer.unref?.();
|
|
295996
|
+
});
|
|
295997
|
+
}
|
|
295998
|
+
async function runUserSystemctl(args, timeout = 2e4) {
|
|
295999
|
+
const result = await runUtilityCommand("systemctl", ["--user", ...args], timeout);
|
|
296000
|
+
return { available: result.available, ok: result.code === 0 };
|
|
295965
296001
|
}
|
|
295966
296002
|
async function readUserSystemctl(args, timeout = 5e3) {
|
|
295967
|
-
|
|
295968
|
-
|
|
295969
|
-
const result = spawnSync3("systemctl", ["--user", ...args], {
|
|
295970
|
-
encoding: "utf8",
|
|
295971
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
295972
|
-
timeout
|
|
295973
|
-
});
|
|
295974
|
-
return result.status === 0 ? result.stdout.trim() : null;
|
|
295975
|
-
} catch {
|
|
295976
|
-
return null;
|
|
295977
|
-
}
|
|
296003
|
+
const result = await runUtilityCommand("systemctl", ["--user", ...args], timeout);
|
|
296004
|
+
return result.code === 0 ? result.stdout.trim() : null;
|
|
295978
296005
|
}
|
|
295979
296006
|
async function hasManagedDaemonService() {
|
|
295980
296007
|
const enabled = await runUserSystemctl(["is-enabled", "omnius-daemon.service"], 5e3);
|
|
@@ -296075,22 +296102,13 @@ async function repairManagedDaemonUnit(port, preferredEntrypoint) {
|
|
|
296075
296102
|
}
|
|
296076
296103
|
async function portHolderPids(port) {
|
|
296077
296104
|
try {
|
|
296078
|
-
const
|
|
296079
|
-
|
|
296080
|
-
encoding: "utf8",
|
|
296081
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
296082
|
-
timeout: 3e3
|
|
296083
|
-
});
|
|
296084
|
-
let output = lsof.stdout ?? "";
|
|
296105
|
+
const lsof = await runUtilityCommand("lsof", ["-ti", `:${port}`], 3e3);
|
|
296106
|
+
let output = lsof.stdout;
|
|
296085
296107
|
if (!output.trim()) {
|
|
296086
|
-
const fuser =
|
|
296087
|
-
|
|
296088
|
-
|
|
296089
|
-
|
|
296090
|
-
});
|
|
296091
|
-
output = `${fuser.stdout ?? ""}
|
|
296092
|
-
${fuser.stderr ?? ""}`;
|
|
296093
|
-
if (lsof.error && fuser.error) return null;
|
|
296108
|
+
const fuser = await runUtilityCommand("fuser", [`${port}/tcp`], 3e3);
|
|
296109
|
+
output = `${fuser.stdout}
|
|
296110
|
+
${fuser.stderr}`;
|
|
296111
|
+
if (!lsof.available && !fuser.available) return null;
|
|
296094
296112
|
}
|
|
296095
296113
|
return output.split(/[\s\n]+/).map((value) => parseInt(value, 10)).filter((pid) => Number.isInteger(pid) && pid > 0 && pid !== process.pid);
|
|
296096
296114
|
} catch {
|
|
@@ -296303,16 +296321,13 @@ async function resolveDaemonCommand(nodeExe, preferredEntrypoint) {
|
|
|
296303
296321
|
const thisDir = dirname7(fileURLToPath2(import.meta.url));
|
|
296304
296322
|
candidates.push(join14(thisDir, "index.js"));
|
|
296305
296323
|
if (process.argv[1]) candidates.push(process.argv[1]);
|
|
296306
|
-
|
|
296307
|
-
|
|
296308
|
-
|
|
296309
|
-
|
|
296310
|
-
|
|
296311
|
-
|
|
296312
|
-
|
|
296313
|
-
if (first) candidates.push(first);
|
|
296314
|
-
} catch {
|
|
296315
|
-
}
|
|
296324
|
+
const which = await runUtilityCommand(
|
|
296325
|
+
process.platform === "win32" ? "where" : "which",
|
|
296326
|
+
["omnius"],
|
|
296327
|
+
3e3
|
|
296328
|
+
);
|
|
296329
|
+
const first = which.stdout.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
296330
|
+
if (first) candidates.push(first);
|
|
296316
296331
|
const seen = /* @__PURE__ */ new Set();
|
|
296317
296332
|
for (const candidate of candidates) {
|
|
296318
296333
|
if (!candidate || seen.has(candidate)) continue;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.727",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.727",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED