mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:59:36 +00:00
Fix LaunchAgent missing TMPDIR causing SQLITE_CANTOPEN on macOS (#20512)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 25ba59765d
Co-authored-by: Clawborn <261310391+Clawborn@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveGatewayStateDir } from "./paths.js";
|
||||
@@ -282,6 +283,22 @@ describe("buildServiceEnvironment", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("forwards TMPDIR from the host environment", () => {
|
||||
const env = buildServiceEnvironment({
|
||||
env: { HOME: "/home/user", TMPDIR: "/var/folders/xw/abc123/T/" },
|
||||
port: 18789,
|
||||
});
|
||||
expect(env.TMPDIR).toBe("/var/folders/xw/abc123/T/");
|
||||
});
|
||||
|
||||
it("falls back to os.tmpdir when TMPDIR is not set", () => {
|
||||
const env = buildServiceEnvironment({
|
||||
env: { HOME: "/home/user" },
|
||||
port: 18789,
|
||||
});
|
||||
expect(env.TMPDIR).toBe(os.tmpdir());
|
||||
});
|
||||
|
||||
it("uses profile-specific unit and label", () => {
|
||||
const env = buildServiceEnvironment({
|
||||
env: { HOME: "/home/user", OPENCLAW_PROFILE: "work" },
|
||||
@@ -301,6 +318,20 @@ describe("buildNodeServiceEnvironment", () => {
|
||||
});
|
||||
expect(env.HOME).toBe("/home/user");
|
||||
});
|
||||
|
||||
it("forwards TMPDIR for node services", () => {
|
||||
const env = buildNodeServiceEnvironment({
|
||||
env: { HOME: "/home/user", TMPDIR: "/tmp/custom" },
|
||||
});
|
||||
expect(env.TMPDIR).toBe("/tmp/custom");
|
||||
});
|
||||
|
||||
it("falls back to os.tmpdir for node services when TMPDIR is not set", () => {
|
||||
const env = buildNodeServiceEnvironment({
|
||||
env: { HOME: "/home/user" },
|
||||
});
|
||||
expect(env.TMPDIR).toBe(os.tmpdir());
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveGatewayStateDir", () => {
|
||||
|
||||
Reference in New Issue
Block a user