- VBOX: Properly trap stderr output from vboxmanage by redirecting it to

stdout.  Error messages should now be properly detected on Linux and
        Mac.
        
    samples/vboxwrapper/
        vbox.cpp

svn path=/trunk/boinc/; revision=24184
This commit is contained in:
Rom Walton 2011-09-13 21:43:58 +00:00
parent e9c5bfe7a8
commit 98efec4538
2 changed files with 14 additions and 1 deletions

View File

@ -5936,3 +5936,11 @@ David 13 Sept 2011
samples/wrapper/
wrapper.cpp
Rom 13 Sept 2011
- VBOX: Properly trap stderr output from vboxmanage by redirecting it to
stdout. Error messages should now be properly detected on Linux and
Mac.
samples/vboxwrapper/
vbox.cpp

View File

@ -106,6 +106,7 @@ int VBOX_VM::vbm_popen(string& arguments, string& output) {
command = "VBoxManage -q " + arguments;
#ifdef _WIN32
STARTUPINFO si;
PROCESS_INFORMATION pi;
SECURITY_ATTRIBUTES sa;
@ -205,10 +206,14 @@ CLEANUP:
return retval;
#else
FILE* fp;
// redirect stderr to stdout for the child process so we can trap it with popen.
string modified_command = command + " 2>&1";
// Execute command
fp = popen(command.c_str(), "r");
fp = popen(modified_command.c_str(), "r");
if (fp == NULL){
fprintf(
stderr,