From: SeokYeon Hwang Date: Wed, 10 Aug 2016 04:56:18 +0000 (+0900) Subject: ecp: fix some issues during launching ECP X-Git-Tag: TizenStudio_2.0_p2.4~27^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dcb16492ef980edabe5c40493b56b057d94d5b07;p=sdk%2Femulator%2Fqemu.git ecp: fix some issues during launching ECP Hide new allocated console and enhance error reporting. Change-Id: Ife12cae1199baaf8bdb584490574562555d3df64 Signed-off-by: SeokYeon Hwang --- diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index 38cf505..cf60abd 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -957,9 +957,7 @@ void ContextMenu::launchControlPanel(QString& command, arguments << httpProxyAddr << httpProxyPort; } - QString loggingCommand = QString("staring ecp: "); - command = QString("\"" + command + "\""); - loggingCommand += command; + QString loggingCommand = QString("launching ecp: \"" + command + "\""); QStringList wrapArguments; for (int i = 0; i < arguments.size(); ++i) { @@ -971,37 +969,42 @@ void ContextMenu::launchControlPanel(QString& command, qInfo() << qPrintable(loggingCommand); QString workingDir = QFileInfo(command).canonicalPath(); - try { #ifndef CONFIG_WIN32 + try { QProcess::startDetached(command, arguments, workingDir); -#else - QString args = QString("\"" + command +"\""); - for (int i = 0; i < arguments.size(); ++i) { - args += " \"" + arguments.at(i) + "\""; - } - bool success = false; - - PROCESS_INFORMATION pinfo; - - STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - success = CreateProcessW(0, (wchar_t*)args.utf16(), - 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0, - workingDir.isEmpty() ? 0 : (wchar_t*)workingDir.utf16(), - &startupInfo, &pinfo); - - if (success) { - CloseHandle(pinfo.hThread); - CloseHandle(pinfo.hProcess); - } -#endif } catch (QString &error) { showMsgBox(QMessageBox::Warning, MSG_INVALID_ECP_OPEN + error); return; } +#else + QString winArguments = QString("\"" + command +"\""); + for (int i = 0; i < arguments.size(); ++i) { + winArguments += " \"" + arguments.at(i) + "\""; + } + + PROCESS_INFORMATION pinfo; + + STARTUPINFOW startupInfo = { sizeof(STARTUPINFO), 0, 0, 0, + (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, + (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, + 0, 0, 0, STARTF_USESHOWWINDOW, SW_HIDE, 0, 0, 0, 0, 0 + }; + bool success = CreateProcessW(0, (LPWSTR)winArguments.utf16(), + 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0, + workingDir.isEmpty() ? 0 : (LPCWSTR)workingDir.utf16(), + &startupInfo, &pinfo); + + + if (!success) { + QString error = QString::number(GetLastError()); + qWarning() << qPrintable(QString("error occured during launching \ + ECP: ") + error); + showMsgBox(QMessageBox::Warning, MSG_INVALID_ECP_OPEN + error); + } + + CloseHandle(pinfo.hThread); + CloseHandle(pinfo.hProcess); +#endif } void ContextMenu::slotControlPanel()