From b021e1dc88420d70fa1dd8da289e1ac0e218f17b Mon Sep 17 00:00:00 2001 From: David Dreschner Date: Sun, 12 Jul 2026 22:39:07 +0200 Subject: [PATCH] fix: Avoid error when files are changed during tar Assisted-by: ClaudeCode:claude-fable-5 Signed-off-by: David Dreschner --- lib/commands/state.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/commands/state.ts b/lib/commands/state.ts index 213362d3..0a64d2d0 100644 --- a/lib/commands/state.ts +++ b/lib/commands/state.ts @@ -12,7 +12,13 @@ export function saveState(): Cypress.Chainable { const snapshot = Math.random().toString(36).substring(7) runCommand(`rm /var/www/html/data-${snapshot}.tar`, { failOnNonZeroExit: false }) - runCommand(`tar cf /var/www/html/data-${snapshot}.tar ./data`) + // The instance keeps writing into ./data while we archive it (e.g. the + // nextcloud.log, caches, session files), so a file can change mid-read and + // GNU tar exits 1 with "file changed as we read it". That is harmless for a + // test-state snapshot: silence the warning and treat exit 1 (benign, + // "some files differ") as success while still failing on a real error + // (exit 2, fatal). + runCommand(`tar --warning=no-file-changed -cf /var/www/html/data-${snapshot}.tar ./data || [ $? -eq 1 ]`) cy.log(`Created snapshot ${snapshot}`)