Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit ab3a041

Browse files
committed
use execFileAsync instead of execAsync
1 parent aa50a93 commit ab3a041

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎apps/array/src/main/services/workspace/service.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { exec } from "node:child_process";
1+
import { exec, execFile } from "node:child_process";
22
import * as fs from "node:fs";
33
import path from "node:path";
44
import { promisify } from "node:util";
@@ -30,6 +30,7 @@ import { cleanupWorkspaceSessions, ScriptRunner } from "./scriptRunner";
3030
import { buildWorkspaceEnv } from "./workspaceEnv";
3131

3232
const execAsync = promisify(exec);
33+
const execFileAsync = promisify(execFile);
3334

3435
function getTaskAssociations(): TaskFolderAssociation[] {
3536
return foldersStore.get("taskAssociations", []);
@@ -137,8 +138,9 @@ export class WorkspaceService extends TypedEventEmitter<WorkspaceServiceEvents>
137138
if (branch) {
138139
try {
139140
// Check if already on the target branch
140-
const { stdout: currentBranch } = await execAsync(
141-
"git rev-parse --abbrev-ref HEAD",
141+
const { stdout: currentBranch } = await execFileAsync(
142+
"git",
143+
["rev-parse", "--abbrev-ref", "HEAD"],
142144
{ cwd: folderPath },
143145
);
144146
if (currentBranch.trim() === branch) {
@@ -148,12 +150,14 @@ export class WorkspaceService extends TypedEventEmitter<WorkspaceServiceEvents>
148150
`Creating/switching to branch ${branch} for task ${taskId}`,
149151
);
150152
try {
151-
await execAsync(`git checkout -b "${branch}"`, {
153+
await execFileAsync("git", ["checkout", "-b", branch], {
152154
cwd: folderPath,
153155
});
154156
log.info(`Created and switched to new branch ${branch}`);
155157
} catch (_error) {
156-
await execAsync(`git checkout "${branch}"`, { cwd: folderPath });
158+
await execFileAsync("git", ["checkout", branch], {
159+
cwd: folderPath,
160+
});
157161
log.info(`Switched to existing branch ${branch}`);
158162
}
159163
}

0 commit comments

Comments
 (0)