tmux-fuzzy-motion 0.0.7 → 0.0.8
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/cli.js +13 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import { dirname, join, resolve } from "node:path";
|
|
|
6
6
|
import { createConnection, createServer } from "node:net";
|
|
7
7
|
import { tmpdir } from "node:os";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
|
+
import { statSync } from "node:fs";
|
|
9
10
|
//#endregion
|
|
10
11
|
//#region src/infra/process.ts
|
|
11
12
|
const runProcess = async (command, args) => new Promise((resolve, reject) => {
|
|
@@ -5749,7 +5750,17 @@ const createMatcher = (candidates, migemo) => {
|
|
|
5749
5750
|
//#region src/commands/runtime.ts
|
|
5750
5751
|
const sleep = async (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
5751
5752
|
const resolveCliEntrypoint = () => process.argv[1] ?? resolve(process.cwd(), "dist/cli.js");
|
|
5752
|
-
const
|
|
5753
|
+
const createDaemonIdentity = () => {
|
|
5754
|
+
const entrypoint = resolveCliEntrypoint();
|
|
5755
|
+
const entrypointMtimeMs = statSync(entrypoint).mtimeMs;
|
|
5756
|
+
return [
|
|
5757
|
+
process.env.TMUX ?? "tmux-fuzzy-motion",
|
|
5758
|
+
process.execPath,
|
|
5759
|
+
entrypoint,
|
|
5760
|
+
String(entrypointMtimeMs)
|
|
5761
|
+
].join("\0");
|
|
5762
|
+
};
|
|
5763
|
+
const createDaemonSocketPath = () => join("/tmp", `tfm-${createHash("sha1").update(createDaemonIdentity()).digest("hex")}.sock`);
|
|
5753
5764
|
const pathExists = async (path) => {
|
|
5754
5765
|
try {
|
|
5755
5766
|
await access(path);
|
|
@@ -5798,7 +5809,7 @@ const isDaemonHealthy = async (socketPath) => new Promise((resolve) => {
|
|
|
5798
5809
|
});
|
|
5799
5810
|
});
|
|
5800
5811
|
const waitForDaemon = async (socketPath) => {
|
|
5801
|
-
for (let attempt = 0; attempt <
|
|
5812
|
+
for (let attempt = 0; attempt < 200; attempt += 1) {
|
|
5802
5813
|
if (await isDaemonHealthy(socketPath)) return;
|
|
5803
5814
|
await sleep(25);
|
|
5804
5815
|
}
|