VirtualBox

Changeset 93333 in vbox for trunk


Ignore:
Timestamp:
Jan 18, 2022 10:35:21 PM (3 years ago)
Author:
vboxsync
Message:

Installer/win/InstallHelper: Added a Sleep(1) to procWait as it would just spin up CPU cycles otherwise. We don't offer a timed process wait interface because of unix, but might be an idea to add it on windows so as to not encourage more this insanity...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp

    r93243 r93333  
    159159        int rc = RTProcWait(Process, RTPROCWAIT_FLAGS_NOBLOCK, pProcSts);
    160160        if (rc == VERR_PROCESS_RUNNING)
    161             continue;
     161            Sleep(1); /* Don't spin uncontrolled. duh. */
    162162        else if (RT_FAILURE(rc))
    163163            return rc;
    164 
    165         if (   pProcSts->iStatus   != 0
    166             || pProcSts->enmReason != RTPROCEXITREASON_NORMAL)
    167         {
    168             rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
    169         }
    170 
    171         return VINF_SUCCESS;
     164        else
     165        {
     166            if (   pProcSts->iStatus   != 0
     167                || pProcSts->enmReason != RTPROCEXITREASON_NORMAL)
     168            {
     169                /** @todo r=bird: This isn't returned, so what's the point here?  */
     170                rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
     171            }
     172            return VINF_SUCCESS;
     173        }
    172174    }
    173175
     
    180182 * @returns VBox status code.
    181183 * @param   hModule             Windows installer module handle.
    182  * @param   pcsExe              Absolute path of executable to run.
    183  * @param   papcszArgs          Pointer to command line arguments to use for calling the executable.
    184  * @param   cArgs               Number of command line arguments in \a papcszArgs.
     184 * @param   pszImage            Absolute path of executable to run.
     185 * @param   papszArgs           Pointer to command line arguments to use for calling the executable.
     186 * @param   cArgs               Number of command line arguments in \a papszArgs.
    185187 */
    186 static int procRun(MSIHANDLE hModule, const char *pcszImage, const char **papcszArgs, size_t cArgs)
     188static int procRun(MSIHANDLE hModule, const char *pszImage, const char * const *papszArgs, size_t cArgs)
    187189{
    188190    RT_NOREF(cArgs);
     
    191193    RT_ZERO(Process);
    192194
    193     uint32_t fProcess  = 0;
     195    uint32_t fProcess = 0;
    194196#ifndef DEBUG
    195              fProcess |= RTPROC_FLAGS_HIDDEN;
     197    fProcess |= RTPROC_FLAGS_HIDDEN;
    196198#endif
    197199
    198     int rc = RTProcCreate(pcszImage, papcszArgs, RTENV_DEFAULT, fProcess, &Process);
     200    int rc = RTProcCreate(pszImage, papszArgs, RTENV_DEFAULT, fProcess, &Process);
    199201    if (RT_SUCCESS(rc))
    200202    {
     
    205207
    206208        if (RT_FAILURE(rc))
    207             logStringF(hModule, "procRun: Waiting for process \"%s\" failed with %Rrc (process status: %d, reason: %d)\n",
    208                        pcszImage, rc, ProcSts.iStatus, ProcSts.enmReason);
     209            logStringF(hModule, "procRun: Waiting for process \"%s\" failed with %Rrc (process status: %d (%#x), reason: %d)\n",
     210                       pszImage, rc, ProcSts.iStatus, ProcSts.iStatus, ProcSts.enmReason);
     211        else if (   ProcSts.iStatus   != 0
     212                 || ProcSts.enmReason != RTPROCEXITREASON_NORMAL)
     213            logStringF(hModule, "procRun: Process \"%s\" terminated with iStatus=%d (%#x) and enmReason=%d\n",
     214                       pszImage, ProcSts.iStatus, ProcSts.iStatus, ProcSts.enmReason);
    209215    }
    210216    else
    211         logStringF(hModule, "procRun: Creating process for \"%s\" failed with %Rrc\n", pcszImage, rc);
     217        logStringF(hModule, "procRun: Creating process for \"%s\" failed with %Rrc\n", pszImage, rc);
    212218
    213219    return rc;
     
    288294
    289295    if (RT_FAILURE(rc))
    290     {
    291296        RTStrFree(pszPythonPath);
    292     }
    293297    else
    294298        *ppszPath = pszPythonPath;
     
    346350    logStringF(hModule, "checkPythonDependencies: Checking for win32api extensions ...");
    347351
    348     const char *papszArgs[4] = { pcszPythonExe, "-c", "import win32api", NULL};
     352    const char *papszArgs[] = { pcszPythonExe, "-c", "import win32api", NULL};
    349353
    350354    int rc = procRun(hModule, pcszPythonExe, papszArgs, RT_ELEMENTS(papszArgs));
    351355    if (RT_SUCCESS(rc))
    352     {
    353356        logStringF(hModule, "checkPythonDependencies: win32api found\n");
    354     }
    355357    else
    356358        logStringF(hModule, "checkPythonDependencies: Importing win32api failed with %Rrc\n", rc);
     
    473475                logStringF(hModule, "InstallPythonAPI: Invoking vboxapisetup.py in \"%s\" ...\n", pszVBoxSDKPath);
    474476
    475                 const char *papszArgs[4] = { pszPythonExe, "vboxapisetup.py", "install", NULL};
     477                const char *papszArgs[] = { pszPythonExe, "vboxapisetup.py", "install", NULL};
    476478
    477479                rc = procRun(hModule, pszPythonExe, papszArgs, RT_ELEMENTS(papszArgs));
    478480                if (RT_SUCCESS(rc))
    479481                    logStringF(hModule, "InstallPythonAPI: Installation of vboxapisetup.py successful\n");
    480 
    481                 if (RT_FAILURE(rc))
     482                else
    482483                    logStringF(hModule, "InstallPythonAPI: Calling vboxapisetup.py failed with %Rrc\n", rc);
    483484            }
     
    500501        logStringF(hModule, "InstallPythonAPI: Validating VBox API ...\n");
    501502
    502         const char *papszArgs[4] = { pszPythonExe, "-c", "from vboxapi import VirtualBoxManager", NULL};
     503        const char *papszArgs[] = { pszPythonExe, "-c", "from vboxapi import VirtualBoxManager", NULL};
    503504
    504505        rc = procRun(hModule, pszPythonExe, papszArgs, RT_ELEMENTS(papszArgs));
    505506        if (RT_SUCCESS(rc))
    506507            logStringF(hModule, "InstallPythonAPI: VBox API looks good.\n");
    507 
    508         if (RT_FAILURE(rc))
     508        else
    509509            logStringF(hModule, "InstallPythonAPI: Validating VBox API failed with %Rrc\n", rc);
    510510    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette