From f5cf5950bd51709b7f9597649ee641677f47506e Mon Sep 17 00:00:00 2001 From: Jeffery Date: Mon, 11 May 2026 13:29:31 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=94=B9=E7=94=A8=20execSync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/git.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/git.js b/app/git.js index 87ec0c9..b67814a 100644 --- a/app/git.js +++ b/app/git.js @@ -1,12 +1,9 @@ -import { spawnSync } from 'child_process'; +import { execSync } from 'child_process'; import path from 'path'; import { GITEA_SERVER_URL, GITEA_REPOSITORY, GITEA_TOKEN, PR_HEAD_BRANCH, FINDINGS_PATH } from './config.js'; function git(args, cwd) { - const result = spawnSync('git', args, { cwd, encoding: 'utf8' }); - if (result.error) throw result.error; - if (result.status !== 0) throw new Error((result.stderr || result.stdout || '').trim()); - return (result.stdout || '').trim(); + return execSync(`git ${args.map(a => `'${a.replace(/'/g, "'\\''")}'`).join(' ')}`, { cwd, encoding: 'utf8' }).trim(); } export async function commitAndPush(workspace) {