Commit da35b53d authored by Jakob Stierhof's avatar Jakob Stierhof

Ensure we abort properly if open fails

Potentially this should be done for all read, open, and
write calls. But for the initial open there are also user
errors that must cause an abort.
parent b41906d5
......@@ -1958,7 +1958,7 @@ private define file_exists (filename) %{{{
private define emceeSetup (ship, steps, options) %{{{
{
variable leader, size, engine;
variable j, set;
variable j, set, err;
engine = ship.engine;
if (0 == engine.id) {
......@@ -1995,7 +1995,15 @@ private define emceeSetup (ship, steps, options) %{{{
throw ReadError, sprintf("File '%s' does not exist", options.output.filename);
}
options.output.open(engine);
try (err) {
options.output.open(engine);
}
catch AnyError:
{
if (ship.abort != NULL)
ship.abort();
throw err.error, err.message; % forward error, make sure we aborted
}
}
else
{
......@@ -2009,7 +2017,15 @@ private define emceeSetup (ship, steps, options) %{{{
throw WriteError, sprintf("File '%s' exists.", options.output.filename);
}
options.output.create(engine);
try (err) {
options.output.create(engine);
}
catch AnyError:
{
if (ship.abort != NULL)
ship.abort();
throw err.error, err.message; % forward error
}
}
leader = engine.leader;
......
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