summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2008-11-25 18:48:22 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-21 13:03:06 (GMT)
commit06b1759e694f57056454506ed10b14eb2639d07c (patch)
tree2654856bf4398d0f7580f3bf890d175ea7e1f7c0
parent02ef8fab7e511f50e901676eac15229eb456b01c (diff)
downloadQt-06b1759e694f57056454506ed10b14eb2639d07c.zip
Qt-06b1759e694f57056454506ed10b14eb2639d07c.tar.gz
Qt-06b1759e694f57056454506ed10b14eb2639d07c.tar.bz2
Add the reason for a process's failure to start to the errorString
It would have been of great help to find this out when I was debugging the previous commit.
-rw-r--r--src/corelib/io/qprocess_win.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 50a4a00..8ece6ec 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -398,6 +398,10 @@ void QProcessPrivate::startProcess()
environment.isEmpty() ? 0 : envlist.data(),
workingDirectory.isEmpty() ? 0 : (wchar_t*)QDir::toNativeSeparators(workingDirectory).utf16(),
&startupInfo, pid);
+ if (!success) {
+ // Capture the error string before we do CloseHandle below
+ q->setErrorString(QProcess::tr("Process failed to start: %1").arg(qt_error_string()));
+ }
if (stdinChannel.pipe[0] != INVALID_Q_PIPE) {
CloseHandle(stdinChannel.pipe[0]);
@@ -416,7 +420,6 @@ void QProcessPrivate::startProcess()
if (!success) {
cleanup();
processError = QProcess::FailedToStart;
- q->setErrorString(QProcess::tr("Process failed to start"));
emit q->error(processError);
q->setProcessState(QProcess::NotRunning);
return;