Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

42th attempt to fix windows build

Louis Beaumontd4c7f7d36b1f
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index f8199cf5b..7325f0656 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -26,7 +26,7 @@ jobs:
api-key: ${{ secrets.CN_API_KEY }}
publish-tauri:
- # needs: draft
+ needs: draft
permissions:
contents: write
strategy:
@@ -135,7 +135,6 @@ jobs:
env:
SKIP_SCREENPIPE_SETUP: true
run: |
- sudo chmod -R 755 ./scripts/pre_build.js
bun ./scripts/pre_build.js ${{ matrix.pre-build-args }}
working-directory: ./screenpipe-app-tauri
diff --git a/screenpipe-app-tauri/scripts/pre_build.js b/screenpipe-app-tauri/scripts/pre_build.js
index 225b37e55..d586d59bb 100644
--- a/screenpipe-app-tauri/scripts/pre_build.js
+++ b/screenpipe-app-tauri/scripts/pre_build.js
@@ -149,13 +149,11 @@ async function copyDenoBinary() {
await fs.access(denoSrc);
// If it exists, proceed with copying
- await fs.copyFile(denoSrc, denoDest1);
- await fs.chmod(denoDest1, 0o755); // Ensure the binary is executable
+ await copyFile(denoSrc, denoDest1);
console.log(`deno binary copied successfully to ${denoDest1}`);
if (platform === 'macos') {
- await fs.copyFile(denoSrc, denoDest2);
- await fs.chmod(denoDest2, 0o755);
+ await copyFile(denoSrc, denoDest2);
console.log(`deno binary also copied to ${denoDest2}`);
}
} catch (error) {
@@ -180,12 +178,36 @@ async function copyDenoBinary() {
console.error('failed to find deno in PATH:', pathError);
console.log('please ensure deno is installed and accessible in your PATH');
}
+ } else if (error.code === 'EPERM') {
+ console.error(`permission denied when copying deno binary. trying elevated copy...`);
+ await elevatedCopy(denoSrc, denoDest1);
+ console.log(`deno binary copied successfully to ${denoDest1} using elevated permissions`);
} else {
- console.error('failed to copy deno binary:', error);
+ console.error(`unexpected error: ${error.message}`);
+ process.exit(1);
}
}
}
+// Helper function to copy file with elevated permissions on Windows
+async function elevatedCopy(src, dest) {
+ if (platform === 'win32') {
+ const { execSync } = require('child_process');
+ const command = `powershell -Command "Start-Process cmd -Verb RunAs -ArgumentList '/c copy ${src} ${dest}' -WindowStyle Hidden -Wait"`;
+ execSync(command);
+ } else {
+ // For non-Windows platforms, fall back to regular copy
+ await fs.copyFile(src, dest);
+ }
+ await fs.chmod(dest, 0o755); // ensure the binary is executable
+}
+
+// Helper function to copy file and set permissions
+async function copyFile(src, dest) {
+ await fs.copyFile(src, dest);
+ await fs.chmod(dest, 0o755); // ensure the binary is executable
+}
+
/* ########## Linux ########## */
if (platform == 'linux') {
// Install APT packages