ClawX windows path robustness (#171)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Haze <hazeone@users.noreply.github.com>
This commit is contained in:
Haze
2026-02-25 22:46:59 +08:00
committed by GitHub
Unverified
parent ade1b2ac8b
commit 9a039ab9fb
7 changed files with 256 additions and 16 deletions

View File

@@ -6,7 +6,7 @@ import { spawn } from 'child_process';
import fs from 'fs';
import path from 'path';
import { app, shell } from 'electron';
import { getOpenClawConfigDir, ensureDir, getClawHubCliBinPath, getClawHubCliEntryPath } from '../utils/paths';
import { getOpenClawConfigDir, ensureDir, getClawHubCliBinPath, getClawHubCliEntryPath, quoteForCmd } from '../utils/paths';
export interface ClawHubSearchParams {
query: string;
@@ -87,17 +87,20 @@ export class ClawHubService {
console.log(`Running ClawHub command: ${displayCommand}`);
const isWin = process.platform === 'win32';
const useShell = isWin && !this.useNodeRunner;
const env = {
...process.env,
CI: 'true',
FORCE_COLOR: '0', // Disable colors for easier parsing
FORCE_COLOR: '0',
};
if (this.useNodeRunner) {
env.ELECTRON_RUN_AS_NODE = '1';
}
const child = spawn(this.cliPath, commandArgs, {
const spawnCmd = useShell ? quoteForCmd(this.cliPath) : this.cliPath;
const spawnArgs = useShell ? commandArgs.map(a => quoteForCmd(a)) : commandArgs;
const child = spawn(spawnCmd, spawnArgs, {
cwd: this.workDir,
shell: isWin && !this.useNodeRunner,
shell: useShell,
env: {
...env,
CLAWHUB_WORKDIR: this.workDir,