fix: workspace create fails on windows (#9101)

* logs

* add awaits to backup and block app start
This commit is contained in:
Jack Kavanagh
2025-09-05 18:00:19 +02:00
committed by GitHub
parent df19a64f16
commit 876ee662d9
3 changed files with 9 additions and 5 deletions

View File

@@ -102,6 +102,8 @@ app.on('ready', async () => {
// Init some important things first
await database.init();
await _createModelInstances();
// backup needs the channel from settings which needs the database
await backupIfNewerVersionAvailable();
sentryWatchAnalyticsEnabled();
watchProxySettings();
windowUtils.init();
@@ -321,7 +323,6 @@ async function _trackStats() {
});
ipcMainOnce('halfSecondAfterAppStart', async () => {
backupIfNewerVersionAvailable();
const { currentVersion, launches, lastVersion } = stats;
const firstLaunch = launches === 1;

View File

@@ -23,7 +23,7 @@ export async function backupIfNewerVersionAvailable() {
);
if (response) {
console.log('[main] Found newer version');
backup();
await backup();
return;
}
console.log('[main] No newer version');
@@ -44,11 +44,12 @@ export async function backup() {
return;
}
const files = await readdir(dataPath);
files.forEach(async (file: string) => {
for (const file of files) {
if (file.endsWith('.db')) {
await copyFile(path.join(dataPath, file), path.join(versionPath, file));
}
});
}
console.log('[main] Exported backup to:', versionPath);
} catch (err) {
console.log('[main] Error exporting backup:', err);

View File

@@ -178,8 +178,10 @@ export async function clientAction({ request, params }: Route.ClientActionArgs)
})}/${scopeToActivity(workspace.scope)}`,
);
} catch (err) {
console.error('Error creating workspace:', err);
return {
error: `Failed to create workspace: ${err instanceof Error ? err.message : String(err)}`,
error: `Failed to create workspace: ${err instanceof Error ? err.message : JSON.stringify(err)}`,
};
}
}