How to make Julia exit 1 on error when run at the end of a pipe?

When I run this at the command line, the exit code seems to be 0:

% echo 'error()' | julia && echo pass 
ERROR: 
Stacktrace:
 [1] error()
   @ Base ./error.jl:44
 [2] top-level scope
   @ none:1
pass
%

In contrast, grep does just fine

% echo 'error()' | grep f && echo pass
%
1 Like