- if an external program fails to run properly, an stdout&stderr log is now printed

Sat, 06 Sep 2014 20:40:58 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sat, 06 Sep 2014 20:40:58 +0300
changeset 879
c5b3bc08e609
parent 878
945e44575b3e
child 880
5dcd2e741d1c

- if an external program fails to run properly, an stdout&stderr log is now printed
- fixed: external program commandlines got botched up due to bad default argument in Join()

src/editHistory.cc file | annotate | diff | comparison | revisions
src/extPrograms.cc file | annotate | diff | comparison | revisions
src/miscallenous.h file | annotate | diff | comparison | revisions
--- a/src/editHistory.cc	Sat Sep 06 15:45:07 2014 +0300
+++ b/src/editHistory.cc	Sat Sep 06 20:40:58 2014 +0300
@@ -105,7 +105,7 @@
 		m_changesets.removeLast();
 	}
 
-	dprint ("History: step added (%1 changes)", m_currentChangeset.size());
+//	dprint ("History: step added (%1 changes)", m_currentChangeset.size());
 	m_changesets << m_currentChangeset;
 	m_currentChangeset.clear();
 	setPosition (position() + 1);
@@ -124,7 +124,7 @@
 
 	entry->setParent (this);
 	m_currentChangeset << entry;
-	dprint ("History: added entry of type %1", entry->getTypeName());
+//	dprint ("History: added entry of type %1", entry->getTypeName());
 }
 
 // =============================================================================
@@ -200,4 +200,4 @@
 void SwapHistory::redo() const
 {
 	undo();
-}
\ No newline at end of file
+}
--- a/src/extPrograms.cc	Sat Sep 06 15:45:07 2014 +0300
+++ b/src/extPrograms.cc	Sat Sep 06 20:40:58 2014 +0300
@@ -24,6 +24,7 @@
 #include <QCheckBox>
 #include <QComboBox>
 #include <QGridLayout>
+#include <QFileInfo>
 #include "main.h"
 #include "configuration.h"
 #include "miscallenous.h"
@@ -280,6 +281,20 @@
 	if (not err.isEmpty())
 	{
 		CriticalError (format ("%1 failed: %2\n", g_extProgNames[prog], err));
+
+		QString filename ("externalProgramOutput.txt");
+		QFile file (filename);
+		if (file.open (QIODevice::WriteOnly | QIODevice::Text))
+		{
+			file.write (proc.readAllStandardOutput());
+			file.write (proc.readAllStandardError());
+			print ("Wrote output and error logs to %1", QFileInfo (file).absoluteFilePath());
+		}
+		else
+		{
+			print ("Couldn't open %1 for writing: %2",
+				QFileInfo (filename).absoluteFilePath(), file.errorString());
+		}
 		return false;
 	}
 
--- a/src/miscallenous.h	Sat Sep 06 15:45:07 2014 +0300
+++ b/src/miscallenous.h	Sat Sep 06 20:40:58 2014 +0300
@@ -40,7 +40,7 @@
 double GetCoordinateOf (const Vertex& a, Axis ax);
 QString MakePrettyFileSize (qint64 size);
 
-QString Join (QList<StringFormatArg> vals, QString delim = "");
+QString Join (QList<StringFormatArg> vals, QString delim = " ");
 
 // Grid stuff
 struct GridData

mercurial