Skip to content

Commit

Permalink
test: check if windows in CI is happy forcing fs.realpathSync
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Dec 2, 2023
1 parent 0faf06c commit 06462a8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'node:fs'
import fsp from 'node:fs/promises'
import os from 'node:os'
import path from 'node:path'
import { exec } from 'node:child_process'
// import { exec } from 'node:child_process'
import { createHash } from 'node:crypto'
import { URL, URLSearchParams, fileURLToPath } from 'node:url'
import { builtinModules, createRequire } from 'node:module'
Expand Down Expand Up @@ -629,12 +629,13 @@ export function copyDir(srcDir: string, destDir: string): void {
// `fs.realpathSync.native` resolves differently in Windows network drive,
// causing file read errors. skip for now.
// https://github.com/nodejs/node/issues/37737
export let safeRealpath = isWindows ? windowsSafeRealPath : fsp.realpath
export const safeRealpath = isWindows ? realpathFallback : fsp.realpath

async function realpathFallback(path: string) {
return fs.realpathSync(path)
}

/*
// Based on https://github.com/larrybahr/windows-network-drive
// MIT License, Copyright (c) 2017 Larry Bahr
const windowsNetworkMap = new Map()
Expand Down Expand Up @@ -692,6 +693,7 @@ async function optimizeSafeRealPath() {
}
})
}
*/

export function ensureWatchedFile(
watcher: FSWatcher,
Expand Down

0 comments on commit 06462a8

Please sign in to comment.