mirror of
https://github.com/Andre-Bzk/tunnler.git
synced 2026-11-15 06:23:04 +01:00
18 lines
578 B
PowerShell
18 lines
578 B
PowerShell
# Startet den Tunnel (falls noetig) und Codex mit Proxy-Variablen nur fuer diesen Aufruf.
|
|
# Alle Argumente werden an codex durchgereicht.
|
|
. "$PSScriptRoot\common.ps1"
|
|
|
|
Start-Tunnel
|
|
|
|
$names = 'HTTPS_PROXY', 'HTTP_PROXY', 'NO_PROXY'
|
|
$saved = @{}
|
|
foreach ($n in $names) { $saved[$n] = [Environment]::GetEnvironmentVariable($n, 'Process') }
|
|
try {
|
|
$env:HTTPS_PROXY = $ProxyUrl
|
|
$env:HTTP_PROXY = $ProxyUrl
|
|
$env:NO_PROXY = 'localhost,127.0.0.1'
|
|
& codex @args
|
|
} finally {
|
|
foreach ($n in $names) { [Environment]::SetEnvironmentVariable($n, $saved[$n], 'Process') }
|
|
}
|