Vboxmange command spawns new window - tested with go os.exec Run - Why - how do I fix?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Vboxmange command spawns new window - tested with go os.exec Run - Why - how do I fix?



Attempting to debug an issue with docker-machine running vboxmange on Win7.
Cannot use docker-machine as it fails to capture the output of vboxmanage commands (A separate window is spawned to run the VBoxManage command).



Using the following test go code to run the vboxmange command it spawns a new window so the stdout is empty;


package main

import (
"bytes"
"fmt"
"log"
"os/exec"
)


func main()
cmd := exec.Command("C:\Program Files\Oracle\VirtualBox\vboxmanage.exe", "--version")
//cmd := exec.Command("C:\Program Files\Docker Toolbox\docker.EXE", "help")

var stdout bytes.Buffer
var stderr bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = &stderr

err := cmd.Run()
if err != nil
log.Fatal(err)

fmt.Printf("StdOut: %qn", stdout.String())



If I run the docker command (commented out above) the command runs without spawning a new window and the output is captured.



FYI I am using VBoxManage version 5.2.8r121009



I realise this may relate to my Win7 environment but I cannot find a solution - help appreciated!



EDIT:
If I run the VBoxManage command in the same prompt and redirect to a file - it works okay so this is very puzzling!



EDIT2:
It's not a golang issue as I can also recreate the problem in python.
Again works fine from the same command line, "vboxmanage.exe --version > output.txt" runs in the same cmd window, but when running this snippet below it spawns a new window;


import subprocess
result = subprocess.run(['C:\Program Files\Oracle\VirtualBox\vboxmanage.exe', '--version'], stdout=subprocess.PIPE)
print('stdout:', result.stdout)



So this must be a VBoxmanage issue!
(Removed the go tag)



EDIT3:



I've opened tickets with Docker and Oracle but I do not have much hope...





If you run the same command via command line does it give the same behavior? If so, this isn't a Go question (or a programming question), it's a VirtualBox question, probably best suited for SuperUser or maybe ServerFault.
– Adrian
Aug 3 at 16:01





Possible duplicate of how to hide command prompt window when using Exec in Golang?
– Michael Hampton
Aug 3 at 16:15





No from the command line it works in the same window - that's one of the reasons I'm puzzled!
– mrkbutty
Aug 3 at 16:39




1 Answer
1



The problem appears to be environmental rather than the cause of docker, virtual box or windows.
Please see thread; https://github.com/docker/machine/issues/4548



I found out it isn't Carbon Black causing the issue on my system!



The CB log files (confer.log) are very useful so I went looking through them.
When launching vboxmanage I noticed that both docker-machine and my vboxtest.exe were being intercepted and vboxmanage was being run by windowssystem32pmlauncher.exe a google search indicated this was AVG but it isn't if you inspect the file it is described as "BeyondTrust PowerBroker for Windows Launcher".



There is a BeyondTrust PowerBroker service so I stopped this and then both the vboxtest.exe and the docker-machine commands work...


<stopped beyond trust>

C:temp>testvbox
StdOut: "5.2.16r123759rn"

<started beyond trust>

C:temp>testvbox
StdOut: ""






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard