- Timestamp:
- Apr 14, 2016 12:08:53 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r59584 r60491 5 5 6 6 /* 7 * Copyright (C) 2010-201 5Oracle Corporation7 * Copyright (C) 2010-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 907 907 * Create a guest session. 908 908 */ 909 if (pCtx->cVerbose > 1)909 if (pCtx->cVerbose) 910 910 RTPrintf("Creating guest session as user '%s'...\n", pCtx->strUsername.c_str()); 911 911 try … … 927 927 * Wait for guest session to start. 928 928 */ 929 if (pCtx->cVerbose > 1)929 if (pCtx->cVerbose) 930 930 RTPrintf("Waiting for guest session to start...\n"); 931 931 GuestSessionWaitResult_T enmWaitResult; … … 955 955 if (SUCCEEDED(rc)) 956 956 { 957 if (pCtx->cVerbose > 1)957 if (pCtx->cVerbose) 958 958 RTPrintf("Successfully started guest session (ID %RU32)\n", pCtx->uSessionID); 959 959 RTStrFree(pszSessionName); … … 1064 1064 && !pCtx->fDetachGuestSession) 1065 1065 { 1066 if (pCtx->cVerbose > 1)1066 if (pCtx->cVerbose) 1067 1067 RTPrintf("Closing guest session ...\n"); 1068 1068 … … 1070 1070 } 1071 1071 else if ( pCtx->fDetachGuestSession 1072 && pCtx->cVerbose > 1)1072 && pCtx->cVerbose) 1073 1073 RTPrintf("Guest session detached\n"); 1074 1074 … … 1498 1498 * Create the process. 1499 1499 */ 1500 if (pCtx->cVerbose > 1)1500 if (pCtx->cVerbose) 1501 1501 { 1502 1502 if (cMsTimeout == 0) … … 1524 1524 ULONG uPID = 0; 1525 1525 CHECK_ERROR_BREAK(pProcess, COMGETTER(PID)(&uPID)); 1526 if (fRunCmd && pCtx->cVerbose > 1)1526 if (fRunCmd && pCtx->cVerbose) 1527 1527 RTPrintf("Process '%s' (PID %RU32) started\n", pszImage, uPID); 1528 1528 else if (!fRunCmd && pCtx->cVerbose) … … 1562 1562 break; 1563 1563 case ProcessWaitResult_Terminate: 1564 if (pCtx->cVerbose > 1)1564 if (pCtx->cVerbose) 1565 1565 RTPrintf("Process terminated\n"); 1566 1566 /* Process terminated, we're done. */ … … 1637 1637 if (g_fGuestCtrlCanceled) 1638 1638 { 1639 if (pCtx->cVerbose > 1)1639 if (pCtx->cVerbose) 1640 1640 RTPrintf("Process execution aborted!\n"); 1641 1641 rcExit = EXITCODEEXEC_CANCELED; … … 1643 1643 else if (fCompletedStartCmd) 1644 1644 { 1645 if (pCtx->cVerbose > 1)1645 if (pCtx->cVerbose) 1646 1646 RTPrintf("Process successfully started!\n"); 1647 1647 rcExit = RTEXITCODE_SUCCESS; … … 1657 1657 LONG lExitCode; 1658 1658 CHECK_ERROR_BREAK(pProcess, COMGETTER(ExitCode)(&lExitCode)); 1659 if (pCtx->cVerbose > 1)1659 if (pCtx->cVerbose) 1660 1660 RTPrintf("Exit code=%u (Status=%u [%s])\n", 1661 1661 lExitCode, procStatus, gctlProcessStatusToText(procStatus)); … … 1666 1666 || procStatus == ProcessStatus_TimedOutAbnormally) 1667 1667 { 1668 if (pCtx->cVerbose > 1)1668 if (pCtx->cVerbose) 1669 1669 RTPrintf("Process timed out (guest side) and %s\n", 1670 1670 procStatus == ProcessStatus_TimedOutAbnormally … … 1674 1674 else 1675 1675 { 1676 if (pCtx->cVerbose > 1)1676 if (pCtx->cVerbose) 1677 1677 RTPrintf("Process now is in status [%s] (unexpected)\n", gctlProcessStatusToText(procStatus)); 1678 1678 rcExit = RTEXITCODE_FAILURE; … … 1681 1681 else if (RT_FAILURE_NP(vrc)) 1682 1682 { 1683 if (pCtx->cVerbose > 1)1683 if (pCtx->cVerbose) 1684 1684 RTPrintf("Process monitor loop quit with vrc=%Rrc\n", vrc); 1685 1685 rcExit = RTEXITCODE_FAILURE; … … 1687 1687 else 1688 1688 { 1689 if (pCtx->cVerbose > 1)1689 if (pCtx->cVerbose) 1690 1690 RTPrintf("Process monitor loop timed out\n"); 1691 1691 rcExit = EXITCODEEXEC_TIMEOUT; … … 1941 1941 && fDirExists) 1942 1942 { 1943 if (pContext->pCmdCtx->cVerbose > 1)1943 if (pContext->pCmdCtx->cVerbose) 1944 1944 RTPrintf("Directory \"%s\" already exists\n", pszDir); 1945 1945 return VINF_SUCCESS; … … 1951 1951 return vrc; 1952 1952 1953 if (pContext->pCmdCtx->cVerbose > 1)1953 if (pContext->pCmdCtx->cVerbose) 1954 1954 RTPrintf("Creating directory \"%s\" ...\n", pszDir); 1955 1955 … … 2127 2127 AssertReturn(enmFlags == kGctlCopyFlags_None, VERR_INVALID_PARAMETER); /* No flags supported yet. */ 2128 2128 2129 if (pContext->pCmdCtx->cVerbose > 1) 2130 RTPrintf("Copying \"%s\" to \"%s\" ...\n", 2131 pszFileSource, pszFileDest); 2129 if (pContext->pCmdCtx->cVerbose) 2130 RTPrintf("Copying \"%s\" to \"%s\" ...\n", pszFileSource, pszFileDest); 2132 2131 2133 2132 if (pContext->fDryRun) … … 2158 2157 else 2159 2158 { 2160 if (pContext->pCmdCtx->cVerbose > 1)2159 if (pContext->pCmdCtx->cVerbose) 2161 2160 rc = showProgress(pProgress); 2162 2161 else … … 2201 2200 vrc = RTPathAppend(szCurDir, sizeof(szCurDir), pszSubDir); 2202 2201 2203 if (pContext->pCmdCtx->cVerbose > 1)2202 if (pContext->pCmdCtx->cVerbose) 2204 2203 RTPrintf("Processing host directory: %s\n", szCurDir); 2205 2204 … … 2246 2245 break; 2247 2246 2248 if (pContext->pCmdCtx->cVerbose > 1)2247 if (pContext->pCmdCtx->cVerbose) 2249 2248 RTPrintf("Directory: %s\n", DirEntry.szName); 2250 2249 … … 2290 2289 } 2291 2290 2292 if (pContext->pCmdCtx->cVerbose > 1)2291 if (pContext->pCmdCtx->cVerbose) 2293 2292 RTPrintf("File: %s\n", DirEntry.szName); 2294 2293 … … 2373 2372 return vrc; 2374 2373 2375 if (pContext->pCmdCtx->cVerbose > 1)2374 if (pContext->pCmdCtx->cVerbose) 2376 2375 RTPrintf("Processing guest directory: %s\n", szCurDir); 2377 2376 … … 2410 2409 break; 2411 2410 2412 if (pContext->pCmdCtx->cVerbose > 1)2411 if (pContext->pCmdCtx->cVerbose) 2413 2412 { 2414 2413 Utf8Str strDir(strName); … … 2460 2459 } 2461 2460 2462 if (pContext->pCmdCtx->cVerbose > 1)2461 if (pContext->pCmdCtx->cVerbose) 2463 2462 RTPrintf("File: %s\n", strFile.c_str()); 2464 2463 … … 2732 2731 * Done parsing arguments, do some more preparations. 2733 2732 */ 2734 if (pCtx->cVerbose > 1)2733 if (pCtx->cVerbose) 2735 2734 { 2736 2735 if (fHostToGuest) … … 2804 2803 } 2805 2804 2806 if (pCtx->cVerbose > 1)2805 if (pCtx->cVerbose) 2807 2806 RTPrintf("Source: %s\n", pszSource); 2808 2807 … … 2942 2941 if (rcExit != RTEXITCODE_SUCCESS) 2943 2942 return rcExit; 2944 if (pCtx->cVerbose > 1)2943 if (pCtx->cVerbose) 2945 2944 RTPrintf("Creating %RU32 directories...\n", argc - GetState.iNext + 1); 2946 2945 } … … 2958 2957 */ 2959 2958 cDirsCreated++; 2960 if (pCtx->cVerbose > 1)2959 if (pCtx->cVerbose) 2961 2960 RTPrintf("Creating directory \"%s\" ...\n", ValueUnion.psz); 2962 2961 try … … 3025 3024 if (rcExit != RTEXITCODE_SUCCESS) 3026 3025 return rcExit; 3027 if (pCtx->cVerbose > 1)3026 if (pCtx->cVerbose) 3028 3027 RTPrintf("Removing %RU32 directorie%ss...\n", argc - GetState.iNext + 1, fRecursive ? "trees" : ""); 3029 3028 } … … 3039 3038 * Remove exactly one directory. 3040 3039 */ 3041 if (pCtx->cVerbose > 1)3040 if (pCtx->cVerbose) 3042 3041 RTPrintf("Removing directory \"%s\" ...\n", ValueUnion.psz); 3043 3042 try … … 3058 3057 * strongly warns against (and half-ways questions the sense of). 3059 3058 */ 3060 if (pCtx->cVerbose > 1)3059 if (pCtx->cVerbose) 3061 3060 RTPrintf("Recursively removing directory \"%s\" ...\n", ValueUnion.psz); 3062 3061 try … … 3072 3071 if (SUCCEEDED(rc)) 3073 3072 { 3074 if (pCtx->cVerbose > 1)3073 if (pCtx->cVerbose) 3075 3074 rc = showProgress(ptrProgress); 3076 3075 else … … 3140 3139 if (rcExit != RTEXITCODE_SUCCESS) 3141 3140 return rcExit; 3142 if (pCtx->cVerbose > 1)3141 if (pCtx->cVerbose) 3143 3142 RTPrintf("Removing %RU32 file(s)...\n", argc - GetState.iNext + 1); 3144 3143 } … … 3154 3153 */ 3155 3154 cFilesDeleted++; 3156 if (pCtx->cVerbose > 1)3155 if (pCtx->cVerbose) 3157 3156 RTPrintf("Removing file \"%s\" ...\n", ValueUnion.psz); 3158 3157 try … … 3265 3264 * Rename (move) the entries. 3266 3265 */ 3267 if (pCtx->cVerbose > 1)3266 if (pCtx->cVerbose) 3268 3267 RTPrintf("Renaming %RU32 %s ...\n", cSources, cSources > 1 ? "entries" : "entry"); 3269 3268 … … 3281 3280 if (FAILED(rc)) 3282 3281 { 3283 if (pCtx->cVerbose > 1)3282 if (pCtx->cVerbose) 3284 3283 RTPrintf("Warning: Cannot stat for element \"%s\": No such element\n", 3285 3284 strCurSource.c_str()); … … 3288 3287 } 3289 3288 3290 if (pCtx->cVerbose > 1)3289 if (pCtx->cVerbose) 3291 3290 RTPrintf("Renaming %s \"%s\" to \"%s\" ...\n", 3292 3291 enmObjType == FsObjType_Directory ? "directory" : "file", … … 3321 3320 3322 3321 if ( (it != vecSources.end()) 3323 && pCtx->cVerbose > 1)3322 && pCtx->cVerbose) 3324 3323 { 3325 3324 RTPrintf("Warning: Not all sources were renamed\n"); … … 3408 3407 * Create the directories. 3409 3408 */ 3410 if (pCtx->cVerbose > 1)3409 if (pCtx->cVerbose) 3411 3410 { 3412 3411 if (fDirectory && !strTempDir.isEmpty()) … … 3506 3505 while (it != mapObjs.end()) 3507 3506 { 3508 if (pCtx->cVerbose > 1)3507 if (pCtx->cVerbose) 3509 3508 RTPrintf("Checking for element \"%s\" ...\n", it->first.c_str()); 3510 3509 … … 3515 3514 /* If there's at least one element which does not exist on the guest, 3516 3515 * drop out with exitcode 1. */ 3517 if (pCtx->cVerbose > 1)3516 if (pCtx->cVerbose) 3518 3517 RTPrintf("Cannot stat for element \"%s\": No such element\n", 3519 3518 it->first.c_str()); … … 3604 3603 } 3605 3604 3606 if (pCtx->cVerbose > 1)3605 if (pCtx->cVerbose) 3607 3606 RTPrintf("Updating Guest Additions ...\n"); 3608 3607 … … 3632 3631 if (RT_SUCCESS(vrc)) 3633 3632 { 3634 if (pCtx->cVerbose > 1)3633 if (pCtx->cVerbose) 3635 3634 RTPrintf("Using source: %s\n", strSource.c_str()); 3636 3635 … … 3645 3644 { 3646 3645 aUpdateFlags.push_back(AdditionsUpdateFlag_WaitForUpdateStartOnly); 3647 if (pCtx->cVerbose > 1)3646 if (pCtx->cVerbose) 3648 3647 RTPrintf("Preparing and waiting for Guest Additions installer to start ...\n"); 3649 3648 } … … 3659 3658 else 3660 3659 { 3661 if (pCtx->cVerbose > 1)3660 if (pCtx->cVerbose) 3662 3661 rc = showProgress(pProgress); 3663 3662 else … … 3668 3667 vrc = gctlPrintProgressError(pProgress); 3669 3668 if ( RT_SUCCESS(vrc) 3670 && pCtx->cVerbose > 1)3669 && pCtx->cVerbose) 3671 3670 { 3672 3671 RTPrintf("Guest Additions update successful\n"); … … 3995 3994 if (fProcFound) 3996 3995 { 3997 if (pCtx->cVerbose > 1)3996 if (pCtx->cVerbose) 3998 3997 RTPrintf("Terminating process (PID %RU32) (session ID %RU32) ...\n", 3999 3998 uPID, uID); … … 4133 4132 4134 4133 Assert(!pSession.isNull()); 4135 if (pCtx->cVerbose > 1)4134 if (pCtx->cVerbose) 4136 4135 RTPrintf("Closing guest session ID=#%RU32 \"%s\" ...\n", 4137 4136 uID, strNameUtf8.c_str()); 4138 4137 CHECK_ERROR_BREAK(pSession, Close()); 4139 if (pCtx->cVerbose > 1)4138 if (pCtx->cVerbose) 4140 4139 RTPrintf("Guest session successfully closed\n"); 4141 4140 … … 4217 4216 } while (0); 4218 4217 4219 if (pCtx->cVerbose > 1)4218 if (pCtx->cVerbose) 4220 4219 RTPrintf("Waiting for events ...\n"); 4221 4220 … … 4226 4225 } 4227 4226 4228 if (pCtx->cVerbose > 1)4227 if (pCtx->cVerbose) 4229 4228 RTPrintf("Signal caught, exiting ...\n"); 4230 4229
Note:
See TracChangeset
for help on using the changeset viewer.