11 lines
592 B
PowerShell
11 lines
592 B
PowerShell
# Hold this handle through frontend generation and Go embedding.
|
|
function Enter-LinkPortBuildLock {
|
|
$directory = Join-Path (Split-Path $PSScriptRoot -Parent) 'bin/build-cache'
|
|
New-Item -ItemType Directory -Path $directory -Force | Out-Null
|
|
try {
|
|
return [IO.File]::Open((Join-Path $directory 'build.lock'), [IO.FileMode]::OpenOrCreate, [IO.FileAccess]::ReadWrite, [IO.FileShare]::None)
|
|
} catch [IO.IOException] {
|
|
throw 'Cannot acquire the build lock. Another build may be running; retry after it finishes. Do not run Vite separately during a Go build.'
|
|
}
|
|
}
|