Skip to content

Commit 01f7d86

Browse files
committed
repl/single: Fold exit points
1 parent 32264c8 commit 01f7d86

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

repl/single.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,17 @@ load_and_execute_single_noreturn()
2424

2525
// Execute the script, passing all command-line arguments to it. If the
2626
// script exits without returning a value, success is assumed.
27+
Exit_Status status = exit_non_integer;
2728
auto ref = repl_script.execute(move(repl_args));
2829
if(ref.is_void())
29-
quick_exit();
30-
31-
const auto& val = ref.dereference_readonly();
32-
if(val.is_integer())
33-
quick_exit(static_cast<Exit_Status>(val.as_integer()));
30+
status = exit_success;
31+
else {
32+
const auto& val = ref.dereference_readonly();
33+
if(val.is_integer())
34+
status = static_cast<Exit_Status>(val.as_integer());
35+
}
3436

35-
quick_exit(exit_non_integer);
37+
quick_exit(status);
3638
}
3739

3840
} // namespace asteria

0 commit comments

Comments
 (0)