Skip to content

Commit

Permalink
[gnucash-commands.cpp] don't load repl if script fails
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherlam committed Oct 28, 2023
1 parent 1b919ce commit 9900b3b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gnucash/gnucash-commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,11 +614,17 @@ run_python_cli (int argc, char **argv, scripting_args* args)
PINFO ("Running python script %s...", script_filename);
auto fp = fopen (script_filename, "rb");
if (!fp)
{
std::cerr << bl::format (_("Unable to load Python script {1}")) % script_filename
<< std::endl;
python_cleanup (config, status);
}
else if (PyRun_SimpleFileEx (fp, script_filename, 1) != 0)
{
std::cerr << bl::format (_("Python script {1} execution failed.")) % script_filename
<< std::endl;
python_cleanup (config, status);
}
}
if (args->interactive)
{
Expand Down

0 comments on commit 9900b3b

Please sign in to comment.