Skip to content

Commit c8fd15c

Browse files
committed
Avoid Windows cargo target locks in FlowChain scripts
1 parent 3257c46 commit c8fd15c

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

infra/scripts/flowchain-common.ps1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,21 @@ function Join-FlowChainProcessArguments {
9696
function Set-FlowChainCargoTargetDir {
9797
param(
9898
[Parameter(Mandatory = $true)]
99-
[string] $RepoRoot
99+
[string] $RepoRoot,
100+
101+
[string] $Purpose = "local"
100102
)
101103

102-
$targetDir = Join-Path $RepoRoot "crates/flowmemory-devnet/target"
104+
$safePurpose = ($Purpose -replace '[^A-Za-z0-9_.-]', '-').Trim("-")
105+
if ([string]::IsNullOrWhiteSpace($safePurpose)) {
106+
$safePurpose = "local"
107+
}
108+
109+
# Keep Cargo outputs away from the default crate target so a running local
110+
# node cannot lock flowmemory-devnet.exe and break setup on Windows.
111+
$targetDir = Join-Path $RepoRoot "devnet/local/cargo-target/$safePurpose-$PID"
103112
$env:CARGO_TARGET_DIR = $targetDir
113+
New-Item -ItemType Directory -Force -Path $targetDir | Out-Null
104114
return $targetDir
105115
}
106116

0 commit comments

Comments
 (0)