Skip to content

Commit abe8895

Browse files
author
User
committed
fix: Access Denied on VBoxManage after shell=True removal
_find_vbox_manage was returning the path wrapped in quotes ("C:\Program Files\...") which worked with shell=True (cmd.exe strips them) but broke with direct arg lists. Removed quotes; debug log now quotes the display string for readability.
1 parent ee9c9ed commit abe8895

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/virtualization_mcp/vbox_compat.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _find_vbox_manage(self) -> str:
5252

5353
for path in common_paths:
5454
if Path(path).exists():
55-
return f'"{path}"'
55+
return path
5656

5757
# Fall back to just 'VBoxManage' and hope it's in PATH
5858
return "VBoxManage"
@@ -80,7 +80,10 @@ def _run_command(self, command: str | list[str], parse_json: bool = False) -> An
8080
# Build the full argument list (no shell=True, no string joining)
8181
full_args = [self.vbox_manage, *command]
8282

83-
logger.debug("Running command: %s", " ".join(str(a) for a in full_args))
83+
# Debug log: quote the executable path if it has spaces (display only)
84+
display = f'"{self.vbox_manage}"' if " " in self.vbox_manage else self.vbox_manage
85+
display += " " + " ".join(str(a) for a in command)
86+
logger.debug("Running command: %s", display)
8487

8588
try:
8689
kwargs: dict[str, Any] = {

0 commit comments

Comments
 (0)