vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
548 stars 90 forks source link

No exit codes upon errors? #239

Closed jason5122 closed 3 years ago

jason5122 commented 3 years ago

Hi, I've installed Asymptote 2.70 from brew. When I use it and an error occurs, no appropriate exit code is raised. For example, error: unexpected end of input or error: could not load module exits with code 0.

Is this even normal? Is there a way I can know when an error has occurred programmatically? Thanks for reading.

johncbowman commented 3 years ago

It works for me. Try

echo "{" | asy - || echo error
echo "{}" | asy - || echo error
jason5122 commented 3 years ago

Here is what I get:

Screen Shot 2021-04-28 at 1 17 27 PM

This isn't right, is it? echo error is not reached in either case.

johncbowman commented 3 years ago

It looks like you are maybe running under MacOS? Can you please confirm what OS you are using. This is an important detail.

jason5122 commented 3 years ago

Yes, I am on macOS 11.1.

RubberNoodles commented 3 years ago

@johncbowman I can't seem to reproduce this on macOS 11.0, running on M1 with ARM architecture.

asy-mac
johncbowman commented 3 years ago

I can reproduce the problem on a MacBook Pro under Big Sur (Darwin Kernel Version 20.1.0). It looks like an OS issue; maybe there is an OS patch to fix error code handling?

johncbowman commented 3 years ago

Followup: it seems to be a multithreading issue as this correctly generates ERROR: echo "{" | asy - -nothreads || echo ERROR

johncbowman commented 3 years ago

Fixed in commit 76702591d248278c20260206bd1d8f6bff27993a.