Ring Errors Question

162 views
Skip to first unread message

Youssef Saeed

unread,
Oct 29, 2024, 11:12:20 AM10/29/24
to The Ring Programming Language

Hello Mahmoud,

Would it be possible to use a non-zero exit status when an error occurs in a ring program?

I believe that every time an error occurs, there should be a non-zero exit status:

exit(RING_EXIT_FAIL);


Best regards,
Youssef

Mahmoud Fayed

unread,
Oct 29, 2024, 11:28:50 AM10/29/24
to The Ring Programming Language
Hello Youssef

Thanks for the report :D


Greetings,
Mahmoud

Youssef Saeed

unread,
Oct 29, 2024, 11:40:00 AM10/29/24
to The Ring Programming Language
Hello Mahmoud,

Thank you very much for the quick fix.

Best regards,
Youssef

Mahmoud Fayed

unread,
Oct 29, 2024, 11:40:52 AM10/29/24
to The Ring Programming Language
Hello Youssef

You are welcome :D

Greetings,
Mahmoud

Youssef Saeed

unread,
Mar 24, 2025, 1:20:25 AMMar 24
to The Ring Programming Language
Hello Mahmoud,

I think the raise and assert functions should also exit with RING_EXIT_FAIL.

Best regards,
Youssef

Mahmoud Fayed

unread,
Mar 24, 2025, 10:15:01 AMMar 24
to The Ring Programming Language
Hello Yousef

>> "I think the raise and assert functions should also exit with RING_EXIT_FAIL."

These functions use RING_API_ERROR which call ring_vm_error()
In ring_vm_error() we use RING_EXIT_FAIL

Greetings,
Mahmoud

Youssef Saeed

unread,
Mar 24, 2025, 10:35:22 AMMar 24
to The Ring Programming Language
Hello Mahmoud,

Thank you for the clarification.

Best regards,
Youssef

Mahmoud Fayed

unread,
Mar 24, 2025, 10:45:12 AMMar 24
to The Ring Programming Language
Hello Youssef

You are welcome :D

Greetings,
Mahmoud

Mansour Ayouni

unread,
Mar 24, 2025, 11:04:00 AMMar 24
to Mahmoud Fayed, The Ring Programming Language

Hello Mahmoud,

Do this fix have any impact in existant programs?

Best,
Mansour


--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ring-lang/bfef39f6-8019-4692-966c-71707e60babcn%40googlegroups.com.

Mahmoud Fayed

unread,
Mar 25, 2025, 2:35:47 PMMar 25
to The Ring Programming Language
Hello Mansour

>> "Do this fix have any impact in existent programs?"

This update is five months old
i.e. it's already applied in Ring 1.22

It's useful when we run Ring programs through batch files/scripts then check the program output 

Greetings,
Mahmoud

Mansour Ayouni

unread,
Mar 25, 2025, 6:21:47 PMMar 25
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

Thank you for your clarification!

All the best,
Mansour

Mahmoud Fayed

unread,
Mar 25, 2025, 7:46:19 PMMar 25
to The Ring Programming Language
Hello Mansour

You are welcome :D

Greetings,
Mahmoud

Message has been deleted

Youssef Saeed

unread,
Dec 7, 2025, 10:48:51 AM (23 hours ago) Dec 7
to The Ring Programming Language
Hello Mahmoud,

While doing more testing, I found that when a syntax error occurs, Ring exits with a status code of 0 (success). A similar script tested with Python correctly exits with 1.

For example:

Ring:

ring test.ring; echo "Ring script exited with: $?"
Error (S1) In file: test.ring
In Line (1) Literal not closed
Ring script exited with: 0

Python:

python test.py; echo "Python script exited with: $?"
  File "/test.py", line 1
    print("llll
          ^
SyntaxError: unterminated string literal (detected at line 1)
Python script exited with: 1

This bug prevents reliable error checking in scripts and CI/CD pipelines.

Best regards,
Youssef

Mahmoud Fayed

unread,
Dec 7, 2025, 11:18:29 AM (23 hours ago) Dec 7
to The Ring Programming Language
Hello Youssef

Thanks for the report


Please test and see if this solves the reported issue

Greetings,
Mahmoud

Youssef Saeed

unread,
Dec 7, 2025, 11:25:34 AM (22 hours ago) Dec 7
to The Ring Programming Language
Hello Mahmoud,

Thank you so much for the incredibly quick fix!

I've just tested the latest changes, and I can confirm that the issue is now resolved. Ring correctly exits with a non-zero status code on syntax errors, which is the expected behavior.

Here is the output from my test:


ring test.ring; echo "Ring script exited with: $?"
Error (S1) In file: test.ring
In Line (1) Literal not closed
Ring script exited with: 1

Best regards,
Youssef

Mahmoud Fayed

unread,
Dec 7, 2025, 11:31:30 AM (22 hours ago) Dec 7
to The Ring Programming Language
Hello Youssef

You are welcome :D

Greetings,
Mahmoud

Reply all
Reply to author
Forward
0 new messages