Skip to content

Commit

Permalink
fix: suppressed error messages in Argon when exiting via a RuntimeExi…
Browse files Browse the repository at this point in the history
…t error (e.g., using the exit function)
  • Loading branch information
jacopodl committed May 17, 2024
1 parent 456a889 commit c208cb8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions argon/vm/argon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ void PrintRaw(ArObject *object) {

assert(object != nullptr);

if(AR_TYPEOF(object, type_error_) && AtomCompareID(((Error*)object)->id, kRuntimeExitError[0]))
return;

str = (String *) Str(object);

Release(object);
Expand Down
10 changes: 8 additions & 2 deletions argon/vm/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,14 @@ void PanicOOM(Fiber *fiber, struct Panic **panic, ArObject *object) {
}

void PublishResult(Fiber *fiber, ArObject *result) {
if (result == nullptr && fiber->context->global_config->stack_trace)
TBPrintPanics(stderr);
if (result == nullptr && fiber->context->global_config->stack_trace) {
auto *err = fiber->panic->object;

if (fiber->panic->panic != nullptr
|| !AR_TYPEOF(err, type_error_)
|| !AtomCompareID(((Error *) err)->id, kRuntimeExitError[0]))
TBPrintPanics(stderr);
}

if (fiber->future != nullptr) {
if (result == nullptr) {
Expand Down

0 comments on commit c208cb8

Please sign in to comment.