Phillipp
Hey,
I am developing an escript and want to return the code 1 to the shell in case of an error, so if my tool gets automated, the automation scripts can detect an error based on the returned code.
So, to keep it simply, we return right from the main function of my escript entrypoint module:
def main(_args) do
System.stop(1)
end
Then after I run my generated escript:
$ echo $?
0
Am I right that there should be a 1 instead of a 0?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #ai
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
josevalim
Here it works from IEx:
So it may be a bug with escripts in Erlang/OTP? I would try to build a minimal erlang escript and see if you can reproduce it there. If so, that’s the bug.
System.stop(1)isinit:stop(1)in Erlang.NobbZ
How do you build and run that escript? Are you using a shell wrapper around it?
Can you perhaps provide a minimal project in GitHub that reproduces the issue? I never experienced any problems.
Phillipp
Yes, seems to fail in the erlang escript too:
elbrujohalcon
I tried with…
…and could definitely reproduce the error, see:
As @Phillipp says… it’s an issue with erlang escripts.
elbrujohalcon
It’s actually already reported since 2014
Phillipp
Ha, that’s a shame. I Just checked,
System.halt(1)does work properly but it does not carefully shut down the VM. I assume it won’t cause any troubles in my case, but we can’t be sure about it.josevalim
Usually it is fine for escripts and sometimes even desired for faster shutdown. The difference is that System.halt() does not shutdown the applications supervision trees one by one. It just halts the system.
OvermindDL1
You can always manually shut down parts that need to be shut down cleanly before calling it though (just don’t shut down the kernel before you get a chance to call halt).