Commit 35743ea1 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen

add disk full error handling to consoleprocess

parent 776c5993
......@@ -65,6 +65,11 @@ QString ConsoleProcess::msgCannotCreateTempFile(const QString &why)
return tr("Cannot create temporary file: %1").arg(why);
}
QString ConsoleProcess::msgCannotWriteTempFile()
{
return tr("Cannot write temporary file. Disk full?");
}
QString ConsoleProcess::msgCannotCreateTempDir(const QString & dir, const QString &why)
{
return tr("Cannot create temporary directory '%1': %2").arg(dir, why);
......
......@@ -104,6 +104,7 @@ private:
static QString msgCommChannelFailed(const QString &error);
static QString msgPromptToClose();
static QString msgCannotCreateTempFile(const QString &why);
static QString msgCannotWriteTempFile();
static QString msgCannotCreateTempDir(const QString & dir, const QString &why);
static QString msgUnexpectedOutput(const QByteArray &what);
static QString msgCannotChangeToWorkDir(const QString & dir, const QString &why);
......
......@@ -173,11 +173,18 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
d->m_tempFile = 0;
return false;
}
QByteArray contents;
foreach (const QString &var, env) {
d->m_tempFile->write(var.toLocal8Bit());
d->m_tempFile->write("", 1);
QByteArray l8b = var.toLocal8Bit();
contents.append(l8b.constData(), l8b.size() + 1);
}
if (d->m_tempFile->write(contents) != contents.size() || !d->m_tempFile->flush()) {
stubServerShutdown();
emit processMessage(msgCannotWriteTempFile(), true);
delete d->m_tempFile;
d->m_tempFile = 0;
return false;
}
d->m_tempFile->flush();
}
xtermArgs
......
......@@ -157,6 +157,16 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
foreach (const QString &var, fixWinEnvironment(env))
out << var << QChar(0);
out << QChar(0);
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
out.flush();
if (out.status() != QTextStream::Ok) {
stubServerShutdown();
emit processMessage(msgCannotWriteTempFile(), true);
delete d->m_tempFile;
d->m_tempFile = 0;
return false;
}
#endif
}
STARTUPINFO si;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment