ei-tui 0.1.13 → 0.1.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ei-tui",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "author": "Flare576",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,8 +11,12 @@ export const quitCommand: Command = {
11
11
  if (forceQuit) {
12
12
  ctx.showNotification("Force quitting...", "info");
13
13
  await ctx.stopProcessor();
14
- ctx.renderer.setTerminalTitle("");
15
- ctx.renderer.destroy();
14
+ try {
15
+ ctx.renderer.setTerminalTitle("");
16
+ ctx.renderer.destroy();
17
+ } catch {
18
+ // Terminal may already be gone; proceed to exit anyway
19
+ }
16
20
  process.exit(0);
17
21
  }
18
22
 
@@ -61,8 +61,12 @@ export const KeyboardProvider: ParentComponent = (props) => {
61
61
  showNotification(`Sync failed: ${result.error}. Use /quit force to exit anyway.`, "error");
62
62
  return;
63
63
  }
64
- renderer.setTerminalTitle("");
65
- renderer.destroy();
64
+ try {
65
+ renderer.setTerminalTitle("");
66
+ renderer.destroy();
67
+ } catch {
68
+ // Terminal may already be gone (e.g. parent session closed); proceed to exit anyway
69
+ }
66
70
  process.exit(0);
67
71
  };
68
72
 
package/tui/src/index.tsx CHANGED
@@ -1,5 +1,7 @@
1
+ import { join } from "path";
1
2
  import { render } from "@opentui/solid";
2
3
  import { App } from "./app";
4
+
3
5
  import { InstanceLock } from "./util/instance-lock";
4
6
  import { FileStorage } from "./storage/file";
5
7
 
@@ -12,7 +14,7 @@ if (!lockResult.acquired) {
12
14
  `\nEi cannot start: another instance is already running.\n` +
13
15
  ` PID: ${lockResult.pid}\n` +
14
16
  ` Started: ${lockResult.started}\n` +
15
- ` Lock: ${storage.getDataPath()}/ei.lock\n\n` +
17
+ ` Lock: ${join(storage.getDataPath(), "ei.lock")}\n\n` +
16
18
  `Close the other instance first, or delete the lock file if it is stale.\n\n`
17
19
  );
18
20
  process.exit(1);
@@ -13,10 +13,9 @@ export class FileStorage implements Storage {
13
13
  private readonly dataPath: string;
14
14
 
15
15
  constructor(dataPath?: string) {
16
- if (dataPath) {
17
- this.dataPath = dataPath;
18
- } else if (process.env.EI_DATA_PATH) {
19
- this.dataPath = process.env.EI_DATA_PATH;
16
+ const raw = dataPath ?? process.env.EI_DATA_PATH;
17
+ if (raw) {
18
+ this.dataPath = raw.replace(/\/+$/, "");
20
19
  } else {
21
20
  const xdgData = process.env.XDG_DATA_HOME || join(process.env.HOME || "~", ".local", "share");
22
21
  this.dataPath = join(xdgData, "ei");