| | |
| | | import { contentCacheFolder } from "./constants.js" |
| | | import { spawnSync } from "child_process" |
| | | import fs from "fs" |
| | | import { rimraf } from "rimraf" |
| | | |
| | | export function escapePath(fp) { |
| | | return fp |
| | |
| | | const flags = ["--no-rebase", "--autostash", "-s", "recursive", "-X", "ours", "--no-edit"] |
| | | const out = spawnSync("git", ["pull", ...flags, origin, branch], { stdio: "inherit" }) |
| | | if (out.stderr) { |
| | | throw new Error(`Error while pulling updates: ${out.stderr}`) |
| | | throw new Error(chalk.red(`Error while pulling updates: ${out.stderr}`)) |
| | | } else if (out.status !== 0) { |
| | | throw new Error(chalk.red("Error while pulling updates")) |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | await fs.promises.rm(contentCacheFolder, { force: true, recursive: true }) |
| | | } |
| | | |
| | | export async function rmrf(path) { |
| | | if (os.platform() == "win32") { |
| | | return rimraf.windows(path) |
| | | } else { |
| | | return rimraf(path) |
| | | } |
| | | } |