@@ -47,9 +47,6 @@ QgsRunProcess::QgsRunProcess( const QString& action, bool capture )
47
47
// inside the capture if() statement.
48
48
connect ( mProcess , SIGNAL ( finished ( int , QProcess::ExitStatus ) ), this , SLOT ( processExit ( int , QProcess::ExitStatus ) ) );
49
49
50
- // start the process!
51
- mProcess ->start ( action );
52
-
53
50
// Use QgsMessageOutput for displaying output to user
54
51
// It will delete itself when the dialog box is closed.
55
52
mOutput = QgsMessageOutput::createMessageOutput ();
@@ -64,6 +61,9 @@ QgsRunProcess::QgsRunProcess( const QString& action, bool capture )
64
61
{
65
62
connect ( mOutputObj , SIGNAL ( destroyed () ), this , SLOT ( dialogGone () ) );
66
63
}
64
+
65
+ // start the process!
66
+ mProcess ->start ( action );
67
67
}
68
68
else
69
69
{
@@ -134,6 +134,8 @@ void QgsRunProcess::dialogGone()
134
134
// class being called after it has been deleted (Qt seems not to be
135
135
// disconnecting them itself)
136
136
137
+ mOutput = 0 ;
138
+
137
139
disconnect ( mProcess , SIGNAL ( error ( QProcess::ProcessError ) ), this , SLOT ( processError ( QProcess::ProcessError ) ) );
138
140
disconnect ( mProcess , SIGNAL ( readyReadStandardOutput () ), this , SLOT ( stdoutAvailable () ) );
139
141
disconnect ( mProcess , SIGNAL ( readyReadStandardError () ), this , SLOT ( stderrAvailable () ) );
@@ -146,7 +148,7 @@ void QgsRunProcess::processError( QProcess::ProcessError err )
146
148
{
147
149
if ( err == QProcess::FailedToStart )
148
150
{
149
- QgsMessageOutput* output = QgsMessageOutput::createMessageOutput ();
151
+ QgsMessageOutput* output = mOutput ? mOutput : QgsMessageOutput::createMessageOutput ();
150
152
output->setMessage ( tr ( " Unable to run command" ) + mCommand , QgsMessageOutput::MessageText );
151
153
// Didn't work, so no need to hang around
152
154
die ();
0 commit comments