- Timestamp:
- Jul 26, 2021 11:09:33 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageCloudMachine.cpp
r90274 r90349 37 37 static RTEXITCODE handleCloudMachineImpl(HandlerArg *a, int iFirst, 38 38 const ComPtr<ICloudProfile> &pProfile); 39 40 static RTEXITCODE handleCloudMachineConsoleHistory(HandlerArg *a, int iFirst, 41 const ComPtr<ICloudProfile> &pProfile); 39 42 static RTEXITCODE listCloudMachinesImpl(HandlerArg *a, int iFirst, 40 43 const ComPtr<ICloudProfile> &pProfile); … … 273 276 { 274 277 kMachineIota = 1000, 278 kMachine_ConsoleHistory, 275 279 kMachine_Info, 276 280 kMachine_List, … … 279 283 static const RTGETOPTDEF s_aOptions[] = 280 284 { 281 { "info", kMachine_Info, RTGETOPT_REQ_NOTHING }, 282 { "list", kMachine_List, RTGETOPT_REQ_NOTHING }, 285 { "console-history", kMachine_ConsoleHistory, RTGETOPT_REQ_NOTHING }, 286 { "consolehistory", kMachine_ConsoleHistory, RTGETOPT_REQ_NOTHING }, 287 { "info", kMachine_Info, RTGETOPT_REQ_NOTHING }, 288 { "list", kMachine_List, RTGETOPT_REQ_NOTHING }, 283 289 CLOUD_MACHINE_RTGETOPTDEF_HELP 284 290 }; … … 302 308 switch (ch) 303 309 { 310 case kMachine_ConsoleHistory: 311 return handleCloudMachineConsoleHistory(a, OptState.iNext, pProfile); 312 304 313 case kMachine_Info: 305 314 return handleCloudMachineInfo(a, OptState.iNext, pProfile); … … 517 526 518 527 528 /* 529 * cloud machine info "id" ... 530 */ 519 531 static RTEXITCODE 520 532 handleCloudMachineInfo(HandlerArg *a, int iFirst, … … 523 535 HRESULT hrc; 524 536 525 if ( a->argc == iFirst)537 if (iFirst == a->argc) 526 538 { 527 539 return RTMsgErrorExit(RTEXITCODE_SYNTAX, … … 773 785 return S_OK; 774 786 } 787 788 789 /* 790 * cloud machine console-history "id" 791 */ 792 static RTEXITCODE 793 handleCloudMachineConsoleHistory(HandlerArg *a, int iFirst, 794 const ComPtr<ICloudProfile> &pProfile) 795 { 796 HRESULT hrc; 797 798 if (iFirst == a->argc) 799 { 800 return RTMsgErrorExit(RTEXITCODE_SYNTAX, 801 "cloud machine info: machine id required\n" 802 "Try '--help' for more information."); 803 } 804 805 if (a->argc - iFirst > 1) 806 { 807 return RTMsgErrorExit(RTEXITCODE_SYNTAX, 808 "cloud machine info: too many arguments\n" 809 "Try '--help' for more information."); 810 } 811 812 ComPtr<ICloudMachine> pMachine; 813 hrc = getMachineById(pMachine, pProfile, a->argv[iFirst]); 814 if (FAILED(hrc)) 815 return RTEXITCODE_FAILURE; 816 817 ComPtr<IDataStream> pHistoryStream; 818 ComPtr<IProgress> pHistoryProgress; 819 CHECK_ERROR2_RET(hrc, pMachine, 820 GetConsoleHistory(pHistoryStream.asOutParam(), 821 pHistoryProgress.asOutParam()), 822 RTEXITCODE_FAILURE); 823 824 hrc = showProgress(pHistoryProgress, SHOW_PROGRESS_NONE); 825 if (FAILED(hrc)) 826 return RTEXITCODE_FAILURE; 827 828 bool fEOF = false; 829 while (!fEOF) 830 { 831 com::SafeArray<BYTE> aChunk; 832 CHECK_ERROR2_RET(hrc, pHistoryStream, 833 Read(64 *_1K, 0, ComSafeArrayAsOutParam(aChunk)), 834 RTEXITCODE_FAILURE); 835 if (aChunk.size() == 0) 836 break; 837 838 RTStrmWrite(g_pStdOut, aChunk.raw(), aChunk.size()); 839 } 840 841 return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE; 842 }
Note:
See TracChangeset
for help on using the changeset viewer.