Loading
fix: Add VirtualBox to PATH only when running VBoxManage (closes #39830)
What does this MR do?
Move the VirtualBox PATH augmentation out of init() and into prepareVBoxManageEnv(), called just before a VBoxManage command runs. The function is idempotent, and off Windows it is a no-op because VBoxManage is already on PATH.
Closes #39830
Before and after
Before: control_windows.go added the Oracle\VirtualBox directories to PATH from init(). Every runner build blank-imports the virtualbox executor, so the PATH of jobs run by other executors, including shell, was polluted.
After: A job that never invokes VirtualBox keeps its PATH unchanged, and the directories are added only when VBoxManage is about to run.
How to validate locally
- On Windows, run
go test ./helpers/virtualbox -run TestPrepareVBoxManageEnv. - Confirm the test passes, including the repeated-call case that checks the PATH is not extended twice.
Acceptance checklist
- PATH is not changed at startup
- PATH is extended only before a VBoxManage command
- Repeated calls do not duplicate entries
- A Windows test covers the behaviour
Edited by Jeston Singh