Ph0enixKM / Amber

💎 Amber the programming language compiled to bash
https://amber-lang.com
GNU General Public License v3.0
3.51k stars 67 forks source link

✨ Amber does not exit with error code in ad-hoc execution mode #204

Closed klausi closed 1 week ago

klausi commented 1 week ago

Current behavior

test.ab:

main {
  $ notexisitngcommand $?
}

Ad-hoc execution:

>>> amber test.ab
bash: line 7: notexisitngcommand: command not found
>>> echo $?
0

Expected behavior

I think amber should forward the error code here and we should see error code 127 from command not found.

>>> amber test.ab
bash: line 7: notexisitngcommand: command not found
>>> echo $?
127

Not sure why exit code 0 is returned, maybe there is a reason?

Ph0enixKM commented 1 week ago

Yes, it should have been 127. This should be fixed.

klausi commented 1 week ago

I'm working on it!

klausi commented 1 week ago

Oh wow, this was fun!

I took the automated test approach from https://rust-cli.github.io/book/tutorial/testing.html#testing-cli-applications-by-running-them