WestKeys

WestKeys

Closing :observer.start() window on macOS doesn't kill the app

Prob belongs under erlang but here goes

screenshot

> iex -S mix
Erlang/OTP 23 [erts-11.1.7] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Interactive Elixir (1.11.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :observer.start()
:ok

screenshot2

So far so good.

Observer docs indicate that to shutdown:

Module

observer

Exports

start() → ok
OTP R15B

Starts the Observer GUI. To stop the tool, close the window.

Say no more, so I go ahead and close the window, but the app remains on the dock.

Right click app on dock and click Quit, nothing happens.

Run :observer.start() again now that window is closed, nothing happens.

Force quit the erlang app, I get the following

iex(2)> 
13:28:01.365 [info]  SIGTERM received - shutting down

[1]    70302 killed     iex -S mix

Does this mean the erlang macOS app I see in dock is the actual iex session, not the observer? Or does it just mean that iex session process is linked to observer process?

Expected behavior behavior: on window close, tool gets stopped, app removed from dock, iex receives message and keeps running. Then, in same iex session, on second :observer.start() call, tool starts anew with app in dock.

Any ideas how to fix?

First 10 of 10 Posts! Switch mode

LostKobrakai

LostKobrakai

My solution: Ignore the app icon. I‘ll go away once you close the iex session.

hauleth

hauleth

It is because of the architecture of macOS and the limitation that only root PID can create window. So in fact, closing the window didn’t closed the “application” (from the OS point of view) as the PID is still there (ERTS need to do some special-case handling for macOS to make it work).

WestKeys

WestKeys

What if I’d like to reopen :observer? Do I need to kill entire iex session?

Do you mean this is the case with other mac apps as well?

LostKobrakai

LostKobrakai

Just like there are many mac apps out there, which can run without having a window open so can the beam. Opening another observer will simply open a new observer window. Think of observer less like a separate app to your shell, but more like your shell is also a program rendering windows.

WestKeys

WestKeys

That’s the issue.

I am not able to reopen :observer window after having closed it

LostKobrakai

LostKobrakai

Ah, if I do rightclick → Quit then it doesn’t work for me as well. If I just close the observer window itself then I can open new windows. Seems like trying to quit the observer sends the mac application into cleanup mode, which then waits for iex to shut down, which never happens.

WestKeys

WestKeys

When

I cannot reopen it from shell, i.e. calling :observer.start() does not relaunch new window

hauleth

hauleth

What Erlang and macOS version you are at? Because it works for me.

WestKeys

WestKeys

Erlang/OTP 23 [erts-11.1.7]

macOS 11.2.1

JoseM111

JoseM111

I usually just do option + cmd + esc and force close it on my mac. Would be more practical if there was a command like the :observer.start( ) to exit out of the app properly.

Where Next?

Trending in Questions Top

jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
silverdr
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated! To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead. Sta...
New
saveman71
Hello ! We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
michallepicki
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
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
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement