mirror of
https://github.com/tiennm99/composes.git
synced 2026-10-11 03:13:16 +00:00
fix: run tea outside git work tree so --login is honored
Invoke-Tea started its job in the caller's directory. When that is a git work tree, tea infers the target from the local remote, and a remote that matches no configured login makes it discard --login, fall back to the first login, and fail with "remote repository required". Pin the job to a neutral directory so the requested login always resolves.
This commit is contained in:
1 parent
0134b64cde
commit
44d3d75546
1 file changed
+6
-1
+6
-1
@@ -54,8 +54,13 @@ if ($planAge.TotalMinutes -gt 15) {
|
||||
if ($targets.Count -eq 0) { "No repos match case(s): $($Case -join ',')"; return }
|
||||
|
||||
# tea reads stdin on some paths; run it as a job so it can never hang the script.
|
||||
# The job must not start inside a git work tree: tea infers its target from the
|
||||
# local remote, and when that remote matches no configured login it discards
|
||||
# --login and fails with "remote repository required". Run from a neutral dir.
|
||||
function Invoke-Tea([string[]]$TeaArgs, [int]$Timeout) {
|
||||
$j = Start-Job -ArgumentList $TeaArgs { param($a) & tea @a 2>&1; "EXIT:$LASTEXITCODE" }
|
||||
$j = Start-Job -ArgumentList $TeaArgs, $env:TEMP {
|
||||
param($a, $neutral) Set-Location $neutral; & tea @a 2>&1; "EXIT:$LASTEXITCODE"
|
||||
}
|
||||
if (Wait-Job $j -Timeout $Timeout) {
|
||||
$out = Receive-Job $j; Remove-Job $j -Force
|
||||
$code = ($out | Where-Object { $_ -like 'EXIT:*' }) -replace 'EXIT:', ''
|
||||
|
||||
Reference in new issue
Block a user