Skip to content

Commit 966a61d

Browse files
authored
Merge pull request #8120 from taskcluster/matt-boris/gwWindowsDetachedConsole
fix(generic-worker): allow tasks to create new consoles (windows)
2 parents 94d37d9 + 44da65b commit 966a61d

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

changelog/issue-8115.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
audience: worker-deployers
2+
level: patch
3+
reference: issue 8115
4+
---
5+
Generic Worker (windows): reverts #8030 to use `CREATE_NEW_CONSOLE` over `CREATE_NO_WINDOW` so that child processes can call `AllocConsole()` to create new consoles.

workers/generic-worker/process/multiuser_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func newCommand(f func() *exec.Cmd, workingDirectory string, env []string, pd *P
8787
cmd.Env = *combined
8888
cmd.Dir = workingDirectory
8989
isWindows8OrGreater := win32.IsWindows8OrGreater()
90-
creationFlags := uint32(win32.CREATE_NEW_PROCESS_GROUP | win32.CREATE_NO_WINDOW)
90+
creationFlags := uint32(win32.CREATE_NEW_PROCESS_GROUP | win32.CREATE_NEW_CONSOLE)
9191
if !isWindows8OrGreater {
9292
creationFlags |= win32.CREATE_BREAKAWAY_FROM_JOB
9393
}

workers/generic-worker/runtime/runtime_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ func (osUser *OSUser) CreateUserProfile() error {
9292
// Verify the profile directory is accessible before returning
9393
// CreateProfile may return before the file system has fully initialized the directory
9494
// This prevents ERROR_NOT_READY errors when LoadUserProfile is called immediately after
95-
const maxRetries = 10
95+
const maxRetries = 25
9696
const initialDelay = 50 * time.Millisecond
97-
const maxDelay = 2 * time.Second
97+
const maxDelay = 5 * time.Second
9898
const backoffMultiplier = 1.5
9999

100100
delay := initialDelay

workers/generic-worker/win32/win32_windows.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ const (
6767

6868
KF_FLAG_CREATE uint32 = 0x00008000
6969

70+
// https://learn.microsoft.com/en-us/windows/win32/procthread/process-creation-flags
7071
CREATE_BREAKAWAY_FROM_JOB = 0x01000000
71-
CREATE_NO_WINDOW = 0x08000000
72+
CREATE_NEW_CONSOLE = 0x00000010
7273
CREATE_NEW_PROCESS_GROUP = 0x00000200
7374

7475
VER_MAJORVERSION = 0x0000002

0 commit comments

Comments
 (0)