mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-06 02:30:47 -08:00
fix: ramdom cleanup timeout
This commit is contained in:
parent
ff4894152e
commit
91f28fdf07
3 changed files with 32 additions and 10 deletions
|
|
@ -37,16 +37,33 @@ After(async function(this: ApplicationWorld, { pickle }) {
|
|||
allWindows.map(async (window) => {
|
||||
try {
|
||||
if (!window.isClosed()) {
|
||||
await window.close();
|
||||
// Add timeout protection for window.close() to prevent hanging
|
||||
await Promise.race([
|
||||
window.close(),
|
||||
new Promise((_, reject) => setTimeout(() => reject(new Error('Window close timeout')), 5000)),
|
||||
]);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error closing window:', error);
|
||||
}
|
||||
}),
|
||||
);
|
||||
await this.app.close();
|
||||
|
||||
// Add timeout protection for app.close() to prevent hanging
|
||||
await Promise.race([
|
||||
this.app.close(),
|
||||
new Promise((_, reject) => setTimeout(() => reject(new Error('App close timeout')), 10000)),
|
||||
]);
|
||||
} catch (error) {
|
||||
console.error('Error during cleanup:', error);
|
||||
// Force kill the app if it hangs
|
||||
try {
|
||||
if (this.app) {
|
||||
await this.app.context().close();
|
||||
}
|
||||
} catch (forceCloseError) {
|
||||
console.error('Error force closing app:', forceCloseError);
|
||||
}
|
||||
}
|
||||
this.app = undefined;
|
||||
this.mainWindow = undefined;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { Then, When } from '@cucumber/cucumber';
|
||||
import { exec as gitExec } from 'dugite';
|
||||
import { backOff } from 'exponential-backoff';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
|
|
@ -536,14 +537,18 @@ When('I create a new wiki workspace with name {string}', async function(this: Ap
|
|||
// Ignore if .git doesn't exist
|
||||
});
|
||||
|
||||
// Initialize fresh git repository for the new wiki
|
||||
const { execSync } = await import('child_process');
|
||||
// Initialize fresh git repository for the new wiki using dugite
|
||||
try {
|
||||
execSync('git init', { cwd: wikiPath });
|
||||
execSync('git config user.email "test@tidgi.test"', { cwd: wikiPath });
|
||||
execSync('git config user.name "TidGi Test"', { cwd: wikiPath });
|
||||
execSync('git add .', { cwd: wikiPath });
|
||||
execSync('git commit -m "Initial commit"', { cwd: wikiPath });
|
||||
// Initialize git repository with master branch
|
||||
await gitExec(['init', '-b', 'master'], wikiPath);
|
||||
|
||||
// Configure git user
|
||||
await gitExec(['config', 'user.email', 'test@tidgi.test'], wikiPath);
|
||||
await gitExec(['config', 'user.name', 'TidGi Test'], wikiPath);
|
||||
|
||||
// Add all files and create initial commit
|
||||
await gitExec(['add', '.'], wikiPath);
|
||||
await gitExec(['commit', '-m', 'Initial commit'], wikiPath);
|
||||
} catch (error) {
|
||||
// Git initialization is not critical for the test, continue anyway
|
||||
console.log('Git initialization skipped:', (error as Error).message);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "tidgi",
|
||||
"productName": "TidGi",
|
||||
"description": "Customizable personal knowledge-base with Github as unlimited storage and blogging platform.",
|
||||
"version": "0.13.0-prerelease5",
|
||||
"version": "0.13.0-prerelease6",
|
||||
"license": "MPL 2.0",
|
||||
"packageManager": "pnpm@10.18.2",
|
||||
"scripts": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue