Closed jeroenvandijk closed 5 years ago
You are totally right, these are bugs.
The command mode passes arguments as strings, therefore exit 2
passes string which fails, but (exit 2)
reads it as a number and is ok. I think that can be fixed by trying to cast the string to a number.
Would something like this be handy https://github.com/wilkerlucio/spec-coerce/ ?
I read that parsing issue of an ip address was a reason to fork tools.reader
. This is a different issue, but also related to coercing. Maybe it is/will be a recurring theme?
Turns out the reader already does coercion, but then the shell argument expansion stringifies things. So I think I will be able to come with a fix for it in a better place.
The coercion should be fixed with this: https://github.com/dundalek/closh/commit/8d90aec84c20e297332d8d269cab7ca30de3be8a
Like the doc string and to prevent unexpected behaviour
I also find this inconsistent with bash:
I would say if it's an alias to a bash function it's should behave like a bash function? WDYT?