-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exec: Don't depend on internals of os.Process
#4233
Conversation
To assign the process to the job object after we create it, we need the `windows.Handle` that backs the process we started with `os/exec`. This was not exported and so we used some gnarly casting to cast the `os.Process` to a structure we authored that had the same layout of `os.Process` so we could grab the handle property. This is unsafe if the layout of the `os.Process` changes, which it did in Go 1.23. Move to code that doesn't depend on the internals of `os.Process` by using the exported Pid to call `windows.OpenProcess` to get a handle and then pass that along to `windows.AssignProcessToJobObject`.
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash:
pwsh:
WindowsPowerShell install
MSI install
Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
To assign the process to the job object after we create it, we need the `windows.Handle` that backs the process we started with `os/exec`. This was not exported and so we used some gnarly casting to cast the `os.Process` to a structure we authored that had the same layout of `os.Process` so we could grab the handle property. This is unsafe if the layout of the `os.Process` changes, which it did in Go 1.23. Move to code that doesn't depend on the internals of `os.Process` by using the exported Pid to call `windows.OpenProcess` to get a handle and then pass that along to `windows.AssignProcessToJobObject`.
To assign the process to the job object after we create it, we need the
windows.Handle
that backs the process we started withos/exec
. This was not exported and so we used some gnarly casting to cast theos.Process
to a structure we authored that had the same layout ofos.Process
so we could grab the handle property.This is unsafe if the layout of the
os.Process
changes, which it did in Go 1.23.Move to code that doesn't depend on the internals of
os.Process
by using the exported Pid to callwindows.OpenProcess
to get a handle and then pass that along towindows.AssignProcessToJobObject
.