Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24b7377

Browse files
committed
feat: support windows containers in bootstrap script
Fixes#7462.
1 parent23e3e4c commit24b7377

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

‎provisionersdk/scripts/bootstrap_windows.ps1

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,24 @@ while ($true) {
2525
}
2626
}
2727

28-
# If the below fails, retrying probably will not help.
29-
Set-MpPreference-DisableRealtimeMonitoring$true-ExclusionPath$env:TEMP\sshd.exe
28+
# Check if running in a Windows container
29+
if (-not (Get-Command'Set-MpPreference'-ErrorAction SilentlyContinue)) {
30+
Write-Output"Set-MpPreference not available, skipping..."
31+
}else {
32+
Set-MpPreference-DisableRealtimeMonitoring$true-ExclusionPath$env:TEMP\sshd.exe
33+
}
34+
3035
$env:CODER_AGENT_AUTH="${AUTH_TYPE}"
3136
$env:CODER_AGENT_URL="${ACCESS_URL}"
32-
Start-Process-FilePath$env:TEMP\sshd.exe-ArgumentList"agent"-PassThru
37+
38+
# Check if we're running inside a Windows container!
39+
$inContainer=$false
40+
if ((Get-ItemProperty'HKLM:\SYSTEM\CurrentControlSet\Control'-Name'ContainerType'-ErrorAction SilentlyContinue)-ne$null) {
41+
$inContainer=$true
42+
}
43+
if ($inContainer) {
44+
# If we're in a container, run in a the foreground!
45+
Start-Process-FilePath$env:TEMP\sshd.exe-ArgumentList"agent"-Wait-NoNewWindow
46+
}else {
47+
Start-Process-FilePath$env:TEMP\sshd.exe-ArgumentList"agent"-PassThru
48+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp