VirtualBox

Ignore:
Timestamp:
Mar 1, 2013 10:44:14 AM (12 years ago)
Author:
vboxsync
Message:

FE/VBoxManage/GuestCtrl: Added proper timeout handling for reading guest process data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp

    r44104 r44883  
    508508 * @param   pProcess        Pointer to appropriate process object.
    509509 * @param   pStrmOutput     Where to write the data.
    510  * @param   hStream         Where to read the data from.
     510 * @param   uHandle         Handle where to read the data from.
     511 * @param   uTimeoutMS      Timeout (in ms) to wait for the operation to complete.
    511512 */
    512513static int ctrlExecPrintOutput(IProcess *pProcess, PRTSTREAM pStrmOutput,
    513                                ULONG uHandle)
     514                               ULONG uHandle, ULONG uTimeoutMS)
    514515{
    515516    AssertPtrReturn(pProcess, VERR_INVALID_POINTER);
     
    519520
    520521    SafeArray<BYTE> aOutputData;
    521     HRESULT rc = pProcess->Read(uHandle, _64K, 30 * 1000 /* 30s timeout. */,
     522    HRESULT rc = pProcess->Read(uHandle, _64K, uTimeoutMS,
    522523                                ComSafeArrayAsOutParam(aOutputData));
    523524    if (FAILED(rc))
     
    854855        if (fReadStdOut) /* Do we need to fetch stdout data? */
    855856        {
    856             vrc = ctrlExecPrintOutput(pProcess, g_pStdOut, 1 /* StdOut */);
     857            cMsTimeLeft = ctrlExecGetRemainingTime(u64StartMS, cMsTimeout);
     858            vrc = ctrlExecPrintOutput(pProcess, g_pStdOut,
     859                                      1 /* StdOut */, cMsTimeLeft);
    857860            fReadStdOut = false;
    858861        }
     
    860863        if (fReadStdErr) /* Do we need to fetch stdout data? */
    861864        {
    862             vrc = ctrlExecPrintOutput(pProcess, g_pStdErr, 2 /* StdErr */);
     865            cMsTimeLeft = ctrlExecGetRemainingTime(u64StartMS, cMsTimeout);
     866            vrc = ctrlExecPrintOutput(pProcess, g_pStdErr,
     867                                      2 /* StdErr */, cMsTimeLeft);
    863868            fReadStdErr = false;
    864869        }
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