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: %q\n", 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...