summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_unix.cpp
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-11-04 05:34:26 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-11-04 05:34:26 (GMT)
commit0ced984d3e2cb2a7a1a219ae7a9b09ff4e15a55c (patch)
treee0112b3ddefa71824e45d55f44517904e3c9680c /src/corelib/io/qprocess_unix.cpp
parenta59291393cc70a1f922e4796efbb72b29920da27 (diff)
parentec502c9e9a26f984023e4f08126e033a504970b2 (diff)
downloadQt-0ced984d3e2cb2a7a1a219ae7a9b09ff4e15a55c.zip
Qt-0ced984d3e2cb2a7a1a219ae7a9b09ff4e15a55c.tar.gz
Qt-0ced984d3e2cb2a7a1a219ae7a9b09ff4e15a55c.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/corelib/io/qprocess_unix.cpp')
-rw-r--r--src/corelib/io/qprocess_unix.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 99296c7..f040d16 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -108,6 +108,10 @@ QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
+// POSIX requires PIPE_BUF to be 512 or larger
+// so we will use 512
+static const int errorBufferMax = 512;
+
#ifdef Q_OS_INTEGRITY
static inline char *strdup(const char *data)
{
@@ -752,18 +756,19 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv
}
// notify failure
+ QString error = qt_error_string(errno);
#if defined (QPROCESS_DEBUG)
- fprintf(stderr, "QProcessPrivate::execChild() failed, notifying parent process\n");
+ fprintf(stderr, "QProcessPrivate::execChild() failed (%s), notifying parent process\n", qPrintable(error));
#endif
- qt_safe_write(childStartedPipe[1], "", 1);
+ qt_safe_write(childStartedPipe[1], error.data(), error.length() * sizeof(QChar));
qt_safe_close(childStartedPipe[1]);
childStartedPipe[1] = -1;
}
bool QProcessPrivate::processStarted()
{
- char c;
- int i = qt_safe_read(childStartedPipe[0], &c, 1);
+ ushort buf[errorBufferMax];
+ int i = qt_safe_read(childStartedPipe[0], &buf, sizeof buf);
if (startupSocketNotifier) {
startupSocketNotifier->setEnabled(false);
startupSocketNotifier->deleteLater();
@@ -775,6 +780,11 @@ bool QProcessPrivate::processStarted()
#if defined (QPROCESS_DEBUG)
qDebug("QProcessPrivate::processStarted() == %s", i <= 0 ? "true" : "false");
#endif
+
+ // did we read an error message?
+ if (i > 0)
+ q_func()->setErrorString(QString::fromUtf16(buf, i / sizeof(QChar)));
+
return i <= 0;
}