1

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...

mrkbutty
  • 489
  • 1
  • 5
  • 13
  • 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 03 '18 at 16:01
  • Possible duplicate of [how to hide command prompt window when using Exec in Golang?](https://stackoverflow.com/questions/42500570/how-to-hide-command-prompt-window-when-using-exec-in-golang) – Michael Hampton Aug 03 '18 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 03 '18 at 16:39

1 Answers1

0

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 windows\system32\pmlauncher.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.16r123759\r\n"

<started beyond trust>

C:\temp>testvbox
StdOut: ""
mrkbutty
  • 489
  • 1
  • 5
  • 13