Changeset 49221 in vbox for trunk/src/VBox
- Timestamp:
- Oct 22, 2013 7:35:56 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 90113
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r49166 r49221 116 116 /** Pointer to the to be used guest session. */ 117 117 ComPtr<IGuestSession> pGuestSession; 118 /** The guest session ID. */ 119 ULONG uSessionID; 118 120 119 121 } GCTLCMDCTX, *PGCTLCMDCTX; … … 693 695 else if (pCtx->fVerbose) 694 696 RTPrintf("Guest session detached\n"); 697 698 pCtx->pGuestSession.setNull(); 699 g_pGuestSession.setNull(); 695 700 } 696 701 … … 893 898 Bstr(pszSessionName).raw(), 894 899 pCtx->pGuestSession.asOutParam())); 900 901 /* 902 * Wait for guest session to start. 903 */ 904 if (pCtx->fVerbose) 905 RTPrintf("Waiting for guest session to start ...\n"); 906 907 com::SafeArray<GuestSessionWaitForFlag_T> aSessionWaitFlags; 908 aSessionWaitFlags.push_back(GuestSessionWaitForFlag_Start); 909 GuestSessionWaitResult_T sessionWaitResult; 910 CHECK_ERROR_BREAK(pCtx->pGuestSession, WaitForArray(ComSafeArrayAsInParam(aSessionWaitFlags), 911 /** @todo Make session handling timeouts configurable. */ 912 30 * 1000, &sessionWaitResult)); 913 914 if ( sessionWaitResult == GuestSessionWaitResult_Start 915 /* Note: This might happen when Guest Additions < 4.3 are installed which don't 916 * support dedicated guest sessions. */ 917 || sessionWaitResult == GuestSessionWaitResult_WaitFlagNotSupported) 918 { 919 CHECK_ERROR_BREAK(pCtx->pGuestSession, COMGETTER(Id)(&pCtx->uSessionID)); 920 if (pCtx->fVerbose) 921 RTPrintf("Guest session (ID %RU32) has been started\n", pCtx->uSessionID); 922 } 923 else 924 { 925 GuestSessionStatus_T sessionStatus; 926 CHECK_ERROR_BREAK(pCtx->pGuestSession, COMGETTER(Status)(&sessionStatus)); 927 rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Error starting guest session (current status is: %s)\n", 928 ctrlSessionStatusToText(sessionStatus)); 929 break; 930 } 895 931 } 896 932 897 if (!(uFlags & CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER)) 933 if ( SUCCEEDED(rc) 934 && !(uFlags & CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER)) 935 { 936 /* Add session to global for being accessible by the 937 * signal handler. */ 938 g_pGuestSession = pCtx->pGuestSession; 939 898 940 ctrlSignalHandlerInstall(); 941 } 899 942 900 943 } while (0); … … 1166 1209 uint64_t u64StartMS = RTTimeMilliTS(); 1167 1210 1168 /*1169 * Wait for guest session to start.1170 */1171 if (pCtx->fVerbose)1172 {1173 if (cMsTimeout == 0)1174 RTPrintf("Waiting for guest session to start ...\n");1175 else1176 RTPrintf("Waiting for guest session to start (within %ums)\n", cMsTimeout);1177 }1178 1179 com::SafeArray<GuestSessionWaitForFlag_T> aSessionWaitFlags;1180 aSessionWaitFlags.push_back(GuestSessionWaitForFlag_Start);1181 GuestSessionWaitResult_T sessionWaitResult;1182 CHECK_ERROR_BREAK(g_pGuestSession, WaitForArray(ComSafeArrayAsInParam(aSessionWaitFlags), cMsTimeout, &sessionWaitResult));1183 ULONG uSessionID;1184 CHECK_ERROR_BREAK(g_pGuestSession, COMGETTER(Id)(&uSessionID));1185 1186 if ( sessionWaitResult == GuestSessionWaitResult_Start1187 /* Note: This might happen when Guest Additions < 4.3 are installed which don't1188 * support dedicated guest sessions. */1189 || sessionWaitResult == GuestSessionWaitResult_WaitFlagNotSupported)1190 {1191 if (pCtx->fVerbose)1192 RTPrintf("Guest session (ID %RU32) has been started\n", uSessionID);1193 }1194 else1195 {1196 RTPrintf("Error starting guest session\n");1197 break;1198 }1199 1200 1211 if (pCtx->fVerbose) 1201 1212 { … … 1210 1221 */ 1211 1222 ComPtr<IGuestProcess> pProcess; 1212 CHECK_ERROR_BREAK( g_pGuestSession, ProcessCreate(Bstr(strCmd).raw(),1213 ComSafeArrayAsInParam(aArgs),1214 ComSafeArrayAsInParam(aEnv),1215 ComSafeArrayAsInParam(aCreateFlags),1216 cMsTimeout,1217 pProcess.asOutParam()));1223 CHECK_ERROR_BREAK(pCtx->pGuestSession, ProcessCreate(Bstr(strCmd).raw(), 1224 ComSafeArrayAsInParam(aArgs), 1225 ComSafeArrayAsInParam(aEnv), 1226 ComSafeArrayAsInParam(aCreateFlags), 1227 cMsTimeout, 1228 pProcess.asOutParam())); 1218 1229 1219 1230 /** @todo does this need signal handling? there's no progress object etc etc */ … … 1253 1264 /* Just print plain PID to make it easier for scripts 1254 1265 * invoking VBoxManage. */ 1255 RTPrintf("%RU32, session ID %RU32\n", uPID, uSessionID);1266 RTPrintf("%RU32, session ID %RU32\n", uPID, pCtx->uSessionID); 1256 1267 } 1257 1268
Note:
See TracChangeset
for help on using the changeset viewer.