- Timestamp:
- May 17, 2010 2:37:48 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/Makefile.kmk
r29117 r29555 43 43 $(if $(VBOX_WITH_GUEST_CONTROL),VBOX_WITH_GUEST_CONTROL) \ 44 44 $(if $(VBOX_WITH_HOSTNETIF_API), VBOX_WITH_HOSTNETIF_API) \ 45 $(if $(VBOX_WITH_VDE), VBOX_WITH_VDE) 45 $(if $(VBOX_WITH_VDE), VBOX_WITH_VDE) \ 46 $(if $(VBOX_WITH_HGCM), VBOX_WITH_HGCM) 46 47 VBoxManage_DEFS.win = _WIN32_WINNT=0x0500 47 48 ifdef VBOX_DYNAMIC_NET_ATTACH -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r29552 r29555 30 30 #include <VBox/com/VirtualBox.h> 31 31 #include <VBox/com/EventQueue.h> 32 33 #include <VBox/HostServices/GuestControlSvc.h> /* for PROC_STS_XXX */ 32 34 33 35 #include <VBox/log.h> … … 85 87 } 86 88 89 static const char *getStatus(ULONG uStatus) 90 { 91 switch (uStatus) 92 { 93 case guestControl::PROC_STS_STARTED: 94 return "started"; 95 case guestControl::PROC_STS_TEN: 96 return "successfully terminated"; 97 case guestControl::PROC_STS_TES: 98 return "terminated by signal"; 99 case guestControl::PROC_STS_TEA: 100 return "abnormally aborted"; 101 case guestControl::PROC_STS_TOK: 102 return "timed out"; 103 case guestControl::PROC_STS_TOA: 104 return "timed out, hanging"; 105 case guestControl::PROC_STS_DWN: 106 return "killed"; 107 case guestControl::PROC_STS_ERROR: 108 return "error"; 109 default: 110 return "unknown"; 111 } 112 } 113 87 114 static int handleExecProgram(HandlerArg *a) 88 115 { … … 101 128 Utf8Str Utf8Password; 102 129 uint32_t u32TimeoutMS = 0; 103 bool waitForExit = false;104 bool waitForStdOut = false;105 bool waitForStdErr = false;106 bool verbose = false;107 bool have_timeout = false;130 bool fWaitForExit = false; 131 bool fWaitForStdOut = false; 132 bool fWaitForStdErr = false; 133 bool fVerbose = false; 134 bool fTimeout = false; 108 135 109 136 /* Always use the actual command line as argv[0]. */ … … 197 224 else 198 225 { 199 have_timeout = true;226 fTimeout = true; 200 227 ++i; 201 228 } … … 208 235 { 209 236 if (!strcmp(a->argv[i + 1], "exit")) 210 waitForExit = true;237 fWaitForExit = true; 211 238 else if (!strcmp(a->argv[i + 1], "stdout")) 212 239 { 213 waitForExit = true;214 waitForStdOut = true;240 fWaitForExit = true; 241 fWaitForStdOut = true; 215 242 } 216 243 else if (!strcmp(a->argv[i + 1], "stderr")) 217 244 { 218 waitForExit = true;219 waitForStdErr = true;245 fWaitForExit = true; 246 fWaitForStdErr = true; 220 247 } 221 248 else … … 226 253 else if (!strcmp(a->argv[i], "--verbose")) 227 254 { 228 verbose = true;255 fVerbose = true; 229 256 } 230 257 /** @todo Add fancy piping stuff here. */ … … 276 303 ULONG uPID = 0; 277 304 278 if ( verbose)305 if (fVerbose) 279 306 { 280 307 if (u32TimeoutMS == 0) … … 292 319 Bstr(Utf8UserName), Bstr(Utf8Password), u32TimeoutMS, 293 320 &uPID, progress.asOutParam())); 294 if ( verbose) RTPrintf("Process '%s' (PID: %u) started\n", Utf8Cmd.raw(), uPID);295 if ( waitForExit)296 { 297 if ( have_timeout)321 if (fVerbose) RTPrintf("Process '%s' (PID: %u) started\n", Utf8Cmd.raw(), uPID); 322 if (fWaitForExit) 323 { 324 if (fTimeout) 298 325 { 299 326 /* Calculate timeout value left after process has been started. */ … … 303 330 { 304 331 u32TimeoutMS = u32TimeoutMS - u64Diff; 305 if ( verbose)332 if (fVerbose) 306 333 RTPrintf("Waiting for process to exit (%ums left) ...\n", u32TimeoutMS); 307 334 } 308 335 else 309 336 { 310 if ( verbose)337 if (fVerbose) 311 338 RTPrintf("No time left to wait for process!\n"); 312 339 } 313 340 } 314 else if ( verbose)341 else if (fVerbose) 315 342 RTPrintf("Waiting for process to exit ...\n"); 316 343 … … 341 368 */ 342 369 343 if ( waitForStdOut344 || waitForStdErr)370 if ( fWaitForStdOut 371 || fWaitForStdErr) 345 372 { 346 373 CHECK_ERROR_BREAK(guest, GetProcessOutput(uPID, 0 /* aFlags */, … … 375 402 break; 376 403 377 if ( have_timeout404 if ( fTimeout 378 405 && RTTimeMilliTS() - u64StartMS > u32TimeoutMS + 5000) 379 406 { … … 426 453 RTPrintf("\n"); 427 454 } 428 if ( verbose)455 if (fVerbose) 429 456 { 430 457 ULONG uRetStatus, uRetExitCode, uRetFlags; 431 458 CHECK_ERROR_BREAK(guest, GetProcessStatus(uPID, &uRetExitCode, &uRetFlags, &uRetStatus)); 432 RTPrintf("Exit code=%u (Status=%u , Flags=%u)\n", uRetExitCode, uRetStatus, uRetFlags);459 RTPrintf("Exit code=%u (Status=%u [%s], Flags=%u)\n", uRetExitCode, uRetStatus, getStatus(uRetStatus), uRetFlags); 433 460 } 434 461 }
Note:
See TracChangeset
for help on using the changeset viewer.