From 69b128734935aa9d9219e2450cf0e7abeda7780c Mon Sep 17 00:00:00 2001 From: James Murdza Date: Sun, 29 Sep 2024 17:40:09 -0700 Subject: [PATCH] fix: handle errors when fixing permissions --- backend/server/src/index.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/server/src/index.ts b/backend/server/src/index.ts index 0e7d4aa..b81d213 100644 --- a/backend/server/src/index.ts +++ b/backend/server/src/index.ts @@ -171,9 +171,13 @@ io.on("connection", async (socket) => { // Change the owner of the project directory to user const fixPermissions = async (projectDirectory: string) => { - await containers[data.sandboxId].commands.run( - `sudo chown -R user "${projectDirectory}"` - ); + try { + await containers[data.sandboxId].commands.run( + `sudo chown -R user "${projectDirectory}"` + ); + } catch (e: any) { + console.log("Failed to fix permissions: " + e); + } }; // Copy all files from the project to the container