fix(scripts): do not fail the desktop smoke test on temp cleanup

A writer of the stopped app can still be finishing in the data directory
when the smoke test removes its temp root, so rmdir failed with
ENOTEMPTY after the test had passed. The temp root is disposable: a
failed cleanup now logs a warning.
This commit is contained in:
shumeiko.it
2026-11-02 17:13:17 +01:00
parent c9ad90c40e
commit a92136cd69

View File

@@ -71,8 +71,17 @@ function tempRoot(name) {
return fs.mkdtempSync(path.join(process.env.RUNNER_TEMP || os.tmpdir(), `waggle-smoke-${name}-`));
}
/**
* Best effort: a background writer of the stopped app (a model download into
* the data directory) can outlive the stop by a moment. The temp root is
* disposable, so a failed cleanup is a warning, not a failed smoke test.
*/
function removeTree(dir) {
fs.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 1000 });
try {
fs.rmSync(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 1000 });
} catch (error) {
log(`Warning: could not remove ${dir}: ${error instanceof Error ? error.message : String(error)}`);
}
}
function portIsFree(port) {