Skip to content

Commit

Permalink
feat: use execa
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelCurrin committed Nov 4, 2024
1 parent 442cf86 commit 469a785
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/git/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
*
* Run Git CLI commands within the extension and capture the text output.
*/
import { exec as _exec } from "child_process";
import * as util from "util";
import { execa } from "execa";
import { Repository } from "../api/git";

const exec = util.promisify(_exec);

// Ensure Git will show special characters literally without quoting the string
// and escaping characters.
const QUOTE_PATH = '-c "core.quotePath=false"';
const QUOTE_PATH = ["-c", "core.quotePath=false"];

const DIFF_INDEX_CMD = "diff-index";
const DIFF_INDEX_OPTIONS = [
Expand All @@ -29,7 +26,7 @@ function _execute(cwd: string, subcommand: string, options: string[] = []) {

console.debug(`Running command: ${command}, cwd: ${cwd}`);

return exec(command, { cwd });
return execa(command, { cwd });
}

/**
Expand Down

0 comments on commit 469a785

Please sign in to comment.