From 8eec47c340d48d9b45970a88da0aaff4e216a7e2 Mon Sep 17 00:00:00 2001
From: kabirgh <15871468+kabirgh@users.noreply.github.com>
Date: Mon, 15 Jan 2024 16:39:16 +0000
Subject: [PATCH] fix: rebuild errors on windows (#692)

---
 quartz/cli/helpers.js |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/quartz/cli/helpers.js b/quartz/cli/helpers.js
index b07d19e..1bb9b23 100644
--- a/quartz/cli/helpers.js
+++ b/quartz/cli/helpers.js
@@ -3,6 +3,7 @@
 import { contentCacheFolder } from "./constants.js"
 import { spawnSync } from "child_process"
 import fs from "fs"
+import { rimraf } from "rimraf"
 
 export function escapePath(fp) {
   return fp
@@ -36,7 +37,9 @@
   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"))
   }
 }
 
@@ -50,3 +53,11 @@
   })
   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)
+  }
+}

--
Gitblit v1.10.0