fix(windows): run bundled openclaw CLI/TUI via node.exe to restore terminal input (#571)

This commit is contained in:
Felix
2026-03-19 13:25:00 +08:00
committed by GitHub
Unverified
parent 2253fed5a1
commit 78a9eb755b
11 changed files with 285 additions and 60 deletions

View File

@@ -31,6 +31,12 @@ function quoteForPowerShell(value: string): string {
return `'${value.replace(/'/g, "''")}'`;
}
function getPackagedWindowsNodePath(): string | null {
if (!app.isPackaged || process.platform !== 'win32') return null;
const nodePath = join(process.resourcesPath, 'bin', 'node.exe');
return existsSync(nodePath) ? nodePath : null;
}
// ── CLI command string (for display / copy) ──────────────────────────────────
export function getOpenClawCliCommand(): string {
@@ -69,7 +75,12 @@ export function getOpenClawCliCommand(): string {
const cliDir = join(process.resourcesPath, 'cli');
const cmdPath = join(cliDir, 'openclaw.cmd');
if (existsSync(cmdPath)) {
return quoteForPowerShell(cmdPath);
return `& ${quoteForPowerShell(cmdPath)}`;
}
const bundledNode = getPackagedWindowsNodePath();
if (bundledNode) {
return `& ${quoteForPowerShell(bundledNode)} ${quoteForPowerShell(entryPath)}`;
}
}