fix(e2e): preserve spaced macOS desktop homes · openclaw/openclaw@d4f6847
vincentkoc
·
2026-06-20
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1116,8 +1116,8 @@ export class NpmUpdateSmoke {
|
1116 | 1116 | ["exec", this.macosVm, "/usr/bin/dscl", ".", "-read", `/Users/${user}`, "NFSHomeDirectory"], |
1117 | 1117 | { check: false, quiet: true, timeoutMs: 30_000 }, |
1118 | 1118 | ).stdout.replaceAll("\r", ""); |
1119 | | -const match = /NFSHomeDirectory:\s*(\S+)/.exec(output); |
1120 | | -return match?.[1] ?? `/Users/${user}`; |
| 1119 | +const match = /^NFSHomeDirectory:\s+(.+)$/m.exec(output); |
| 1120 | +return match?.[1]?.trim() || `/Users/${user}`; |
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | private async guestWindows( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -689,6 +689,48 @@ exit 1
|
689 | 689 | expect(script).toContain('"/usr/sbin/chown", sudoUser, scriptPath'); |
690 | 690 | }); |
691 | 691 | |
| 692 | +it("keeps spaces in macOS sudo fallback desktop homes", () => { |
| 693 | +const root = makeTempDir(); |
| 694 | +const prlctlPath = path.join(root, "prlctl"); |
| 695 | +writeFileSync( |
| 696 | +prlctlPath, |
| 697 | +`#!/usr/bin/env bash |
| 698 | +set -euo pipefail |
| 699 | +args=" $* " |
| 700 | +if [[ "$args" == *" /usr/bin/dscl . -read /Users/clawuser NFSHomeDirectory"* ]]; then |
| 701 | + printf '%s\\n' 'NFSHomeDirectory: /Volumes/Macintosh HD/Users/clawuser' |
| 702 | + exit 0 |
| 703 | +fi |
| 704 | +exit 7 |
| 705 | +`, |
| 706 | +); |
| 707 | +chmodSync(prlctlPath, 0o755); |
| 708 | + |
| 709 | +withEnv( |
| 710 | +{ |
| 711 | +OPENAI_API_KEY: "test-key", |
| 712 | +PATH: `${root}${path.delimiter}${process.env.PATH ?? ""}`, |
| 713 | +}, |
| 714 | +() => { |
| 715 | +const smoke = new NpmUpdateSmoke({ |
| 716 | + ...TEST_AUTH, |
| 717 | +json: false, |
| 718 | +packageSpec: "openclaw@latest", |
| 719 | +platforms: new Set<Platform>(["macos"]), |
| 720 | +provider: "openai", |
| 721 | +updateTarget: "local-main", |
| 722 | +}); |
| 723 | +const resolveMacosDesktopHome = Reflect.get(smoke, "resolveMacosDesktopHome") as ( |
| 724 | +user: string, |
| 725 | +) => string; |
| 726 | + |
| 727 | +expect(resolveMacosDesktopHome.call(smoke, "clawuser")).toBe( |
| 728 | +"/Volumes/Macintosh HD/Users/clawuser", |
| 729 | +); |
| 730 | +}, |
| 731 | +); |
| 732 | +}); |
| 733 | + |
692 | 734 | it("scrubs future plugin entries before invoking old same-guest updaters", () => { |
693 | 735 | const script = readFileSync(UPDATE_SCRIPTS_PATH, "utf8"); |
694 | 736 | const macosScript = macosUpdateScript({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。