Changeset 39418 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 25, 2011 10:11:06 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75045
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r38656 r39418 570 570 571 571 case GETOPTDEF_EXEC_WAITFORSTDOUT: 572 f WaitForExit = true;573 fWaitFor StdOut = true;572 fExecFlags |= ExecuteProcessFlag_WaitForStdOut; 573 fWaitForExit = fWaitForStdOut = true; 574 574 break; 575 575 576 576 case GETOPTDEF_EXEC_WAITFORSTDERR: 577 fExecFlags |= ExecuteProcessFlag_WaitForStdErr; 577 578 fWaitForExit = (fOutputFlags |= ProcessOutputFlag_StdErr) ? true : false; 578 579 break; … … 662 663 if (fCancelable) 663 664 ctrlSignalHandlerInstall(); 665 666 vrc = RTStrmSetMode(g_pStdOut, 1 /* Binary mode */, -1 /* Code set, unchanged */); 667 if (RT_FAILURE(vrc)) 668 RTMsgError("Unable to set stdout's binary mode, rc=%Rrc\n", vrc); 664 669 665 670 /* Wait for process to exit ... */ … … 711 716 if (cbOutputData > 0) 712 717 { 718 BYTE *pBuf = aOutputData.raw(); 719 AssertPtr(pBuf); 720 pBuf[cbOutputData - 1] = 0; /* Properly terminate buffer. */ 721 713 722 /** @todo r=bird: Use a VFS I/O stream filter for doing this, it's a 714 723 * generic problem and the new VFS APIs will handle it more … … 721 730 * Windows. Otherwise we end up with CR/CR/LF on Windows. 722 731 */ 723 ULONG cbOutputDataPrint = cbOutputData; 724 for (BYTE *s = aOutputData.raw(), *d = s;725 s - aOutputData.raw() < (ssize_t)cbOutputData;726 s++, d++)732 733 char *pszBufUTF8; 734 vrc = RTStrCurrentCPToUtf8(&pszBufUTF8, (const char*)aOutputData.raw()); 735 if (RT_SUCCESS(vrc)) 727 736 { 728 if (*s == '\r') 737 cbOutputData = strlen(pszBufUTF8); 738 739 ULONG cbOutputDataPrint = cbOutputData; 740 for (char *s = pszBufUTF8, *d = s; 741 s - pszBufUTF8 < (ssize_t)cbOutputData; 742 s++, d++) 729 743 { 730 /* skip over CR, adjust destination */ 731 d--; 732 cbOutputDataPrint--; 744 if (*s == '\r') 745 { 746 /* skip over CR, adjust destination */ 747 d--; 748 cbOutputDataPrint--; 749 } 750 else if (s != d) 751 *d = *s; 733 752 } 734 else if (s != d) 735 *d = *s; 753 754 vrc = RTStrmWrite(g_pStdOut, pszBufUTF8, cbOutputDataPrint); 755 if (RT_FAILURE(vrc)) 756 RTMsgError("Unable to write output, rc=%Rrc\n", vrc); 757 758 RTStrFree(pszBufUTF8); 736 759 } 737 RTStrmWrite(g_pStdOut, aOutputData.raw(), cbOutputDataPrint); 760 else 761 RTMsgError("Unable to convert output, rc=%Rrc\n", vrc); 738 762 } 739 763 } … … 2240 2264 AssertPtrReturn(pArg, VERR_INVALID_PARAMETER); 2241 2265 2242 #ifdef DEBUG_andy 2266 #ifdef DEBUG_andy_disabled 2243 2267 if (RT_FAILURE(tstTranslatePath())) 2244 2268 return RTEXITCODE_FAILURE; … … 2290 2314 2291 2315 ctrlUninitVM(pArg); 2292 return rcExit;2316 return RT_FAILURE(rcExit) ? RTEXITCODE_FAILURE : RTEXITCODE_SUCCESS; 2293 2317 } 2294 2318 return RTEXITCODE_FAILURE;
Note:
See TracChangeset
for help on using the changeset viewer.