Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
334175b9
Commit
334175b9
authored
10 years ago
by
Gigg, Martyn Anthony
Browse files
Options
Downloads
Patches
Plain Diff
Ensure MantidPlot exits with 0 status code on script success.
Refs #9559
parent
b9c991e7
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
+13
-0
13 additions, 0 deletions
Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
Code/Mantid/MantidPlot/src/ApplicationWindow.h
+2
-0
2 additions, 0 deletions
Code/Mantid/MantidPlot/src/ApplicationWindow.h
with
15 additions
and
0 deletions
Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
+
13
−
0
View file @
334175b9
...
...
@@ -16438,6 +16438,7 @@ void ApplicationWindow::executeScriptFile(const QString & filename, const Script
code += in.readLine() + "\n";
}
Script *runner = scriptingEnv()->newScript(filename, this, Script::NonInteractive);
connect(runner, SIGNAL(finished(const QString &)), this, SLOT(onScriptExecuteSuccess(const QString &)));
connect(runner, SIGNAL(error(const QString &, const QString &, int)), this, SLOT(onScriptExecuteError(const QString &, const QString &, int)));
runner->redirectStdOut(false);
scriptingEnv()->redirectStdOut(false);
...
...
@@ -16459,6 +16460,18 @@ void ApplicationWindow::executeScriptFile(const QString & filename, const Script
delete runner;
}
/**
* This is the slot for handing script exits when it returns successfully
*
* @param lineNumber The line number in the script that caused the error.
*/
void ApplicationWindow::onScriptExecuteSuccess(const QString & message)
{
g_log.notice() << message.toStdString() << "\n";
this->setExitCode(0);
this->exitWithPresetCode();
}
/**
* This is the slot for handing script execution errors. It is only
* attached by ::executeScriptFile which is only done in the '-xq'
...
...
This diff is collapsed.
Click to expand it.
Code/Mantid/MantidPlot/src/ApplicationWindow.h
+
2
−
0
View file @
334175b9
...
...
@@ -230,6 +230,8 @@ public slots:
ApplicationWindow
*
loadScript
(
const
QString
&
fn
);
/// Runs a script from a file. Mainly useful for automatically running scripts
void
executeScriptFile
(
const
QString
&
filename
,
const
Script
::
ExecutionMode
execMode
);
/// Slot to connect the script execution success
void
onScriptExecuteSuccess
(
const
QString
&
message
);
/// Slot to connect the script execution errors to
void
onScriptExecuteError
(
const
QString
&
message
,
const
QString
&
scriptName
,
int
lineNumber
);
/// Runs an arbitrary lump of python code, return true/false on success/failure.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment