Skip to content

Conversation

@niklas
Copy link
Contributor

@niklas niklas commented Nov 1, 2025

When the build script fails for some reason, the EngineNode hung, because the :EXIT would not be received, as the Port was started in some other process, but not in the EngineNode's GenServer. Only the latter explicitely traps exits.

To fix this without causing any side effects (handle_info(:EXIT) in Node), we run the Port in a Task subprocess that traps exits.

Additionally, we log the last line received from the build script to help the user to debug the issue, instead of failing silently with exit reason :normal.

When the build script fails for some reason, the EngineNode hung, because the
:EXIT would not be received, as the Port was started in some other process, but
not in the EngineNode's GenServer. Only the latter explicitely traps exits.

To fix this without causing any side effects (handle_info(:EXIT) in Node), we
run the Port in a Task subprocess that traps exits.

Additionally, we log the last line received from the build script to help the
user to debug the issue, instead of failing silently with exit reason :normal.
@niklas niklas changed the title Handle failing build script feat(build script): Handle failing build script Nov 1, 2025
@niklas niklas changed the title feat(build script): Handle failing build script feat(build script): handle failing build script Nov 1, 2025
@mhanberg mhanberg changed the title feat(build script): handle failing build script feat(engine): handle failing build script Nov 2, 2025
@mhanberg mhanberg changed the title feat(engine): handle failing build script fix(engine): handle failing build script Nov 2, 2025

{^port, _data} ->
wait_for_engine(port)
{^port, {:data, data}} ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might also help if we log the build output here.

Copy link
Collaborator

@doorgan doorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works well, I get the right message in my nvim lsp logs:

[ERROR][2025-11-07 16:10:14] ...lsp/handlers.lua:562    "Couldn't find an elixir executable for project at /Users/dorgan/dev/rainet. Using shell at ...

@doorgan doorgan force-pushed the handle-failed-build-script branch from 4024e78 to adcc556 Compare November 7, 2025 19:19
@doorgan doorgan force-pushed the handle-failed-build-script branch from 0c54eda to 1e893ba Compare November 7, 2025 19:45
@doorgan doorgan merged commit ce9ac22 into elixir-lang:main Nov 7, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants