From 46131c859ce7dcafcc5c736e53f212b8d4ebe6c7 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Tue, 13 Jan 2026 13:44:22 +0100 Subject: [PATCH 1/2] fix: try to resolve Windows touch EPERM error --- cli/src/services/server/touch.services.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cli/src/services/server/touch.services.ts b/cli/src/services/server/touch.services.ts index 44d3100..bd41e89 100644 --- a/cli/src/services/server/touch.services.ts +++ b/cli/src/services/server/touch.services.ts @@ -1,7 +1,7 @@ import {isEmptyString} from '@dfinity/utils'; import kleur from 'kleur'; import {existsSync} from 'node:fs'; -import {utimes} from 'node:fs/promises'; +import {readFile, utimes, writeFile} from 'node:fs/promises'; import {join} from 'node:path'; import {DEV_DEPLOY_FOLDER} from '../../constants/dev.constants'; @@ -36,6 +36,17 @@ export const touchWatchedFile = async ({searchParams}: {searchParams: URLSearchP }; const touch = async (filePath: string) => { - const now = new Date(); - await utimes(filePath, now, now); + try { + const now = new Date(); + await utimes(filePath, now, now); + } catch (err: unknown) { + if (err instanceof Error && 'code' in err && (err as NodeJS.ErrnoException).code === 'EPERM') { + // Fallback for Windows Docker: force timestamp update by rewriting file + const content = await readFile(filePath); + await writeFile(filePath, content); + return; + } + + throw err; + } }; From 6a9d21fb760cf0bfc1c824476cd5d3ee5d62e281 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Tue, 13 Jan 2026 13:55:47 +0100 Subject: [PATCH 2/2] chore: optimistic lint --- cli/src/services/server/touch.services.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/src/services/server/touch.services.ts b/cli/src/services/server/touch.services.ts index bd41e89..41d844a 100644 --- a/cli/src/services/server/touch.services.ts +++ b/cli/src/services/server/touch.services.ts @@ -40,6 +40,7 @@ const touch = async (filePath: string) => { const now = new Date(); await utimes(filePath, now, now); } catch (err: unknown) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion if (err instanceof Error && 'code' in err && (err as NodeJS.ErrnoException).code === 'EPERM') { // Fallback for Windows Docker: force timestamp update by rewriting file const content = await readFile(filePath);