ui: fixed status error may not show up if custom command fails on windows

This commit is contained in:
mlangkabel
2019-01-21 16:38:47 +01:00
parent 6f0cc614e2
commit 5dcecdb3bd
3 changed files with 40 additions and 7 deletions
+30 -1
View File
@@ -97,10 +97,39 @@ int utility::executeProcessAndGetExitCode(
const std::vector<std::wstring>& commandArguments,
const FilePath& workingDirectory,
const int timeout,
std::wstring* processOutput
std::wstring* processOutput,
std::wstring* errorMessage
){
QProcess process;
if (errorMessage != nullptr)
{
QObject::connect(&process, &QProcess::errorOccurred, [errorMessage, commandPath](QProcess::ProcessError error)
{
switch (error)
{
case QProcess::FailedToStart:
*errorMessage = L"File not found or resource error occurred.";
break;
case QProcess::Crashed:
*errorMessage = L"Process crashed.";
break;
case QProcess::Timedout:
*errorMessage = L"Process timed out.";
break;
case QProcess::ReadError:
*errorMessage = L"A read error occurred while executing process.";
break;
case QProcess::WriteError:
*errorMessage = L"A write error occurred while executing process.";
break;
case QProcess::UnknownError:
*errorMessage = L"An unknown error occurred while executing process.";
break;
};
});
}
if (!workingDirectory.empty())
{
process.setWorkingDirectory(QString::fromStdWString(workingDirectory.wstr()));