File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -279,6 +279,7 @@ function Test-GitHubApiJsonFallback {
279279 $tempRoot = Join-Path ([IO.Path ]::GetTempPath()) (" colipas-release-selftest-" + [Guid ]::NewGuid().ToString(" N" ))
280280 New-Item - ItemType Directory - Path $tempRoot | Out-Null
281281 $mockGhPath = Join-Path $tempRoot " gh.cmd"
282+ $mockGhUnixPath = Join-Path $tempRoot " gh"
282283 $mockResponderPath = Join-Path $tempRoot " mock-gh-response.ps1"
283284 $capturePath = Join-Path $tempRoot " capture.json"
284285 $previousPath = $env: PATH
@@ -304,6 +305,30 @@ if "%input%"=="" exit /b 22
304305powershell -NoProfile -ExecutionPolicy Bypass -File "%COLIPAS_GH_SELFTEST_RESPONDER%" "%input%"
305306'@ | Set-Content - LiteralPath $mockGhPath - Encoding ASCII
306307 @'
308+ #!/usr/bin/env sh
309+ if [ "$1" != "api" ]; then
310+ exit 21
311+ fi
312+
313+ input=""
314+ while [ "$#" -gt 0 ]; do
315+ if [ "$1" = "--input" ]; then
316+ shift
317+ input="${1:-}"
318+ fi
319+ shift || true
320+ done
321+
322+ if [ -z "$input" ]; then
323+ exit 22
324+ fi
325+
326+ pwsh -NoProfile -ExecutionPolicy Bypass -File "$COLIPAS_GH_SELFTEST_RESPONDER" "$input"
327+ '@ | Set-Content - LiteralPath $mockGhUnixPath - Encoding ASCII
328+ if (Get-Command chmod - ErrorAction SilentlyContinue) {
329+ & chmod + x $mockGhUnixPath
330+ }
331+ @'
307332param([string]$InputJsonPath)
308333
309334$bytes = [IO.File]::ReadAllBytes($InputJsonPath)
You can’t perform that action at this time.
0 commit comments