Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-zero exit code on error #338

Merged
merged 5 commits into from
Jan 16, 2024

Conversation

marvinborner
Copy link
Member

This PR fixes issue #293.

If a message with error severity is logged in compilation/interpret/build mode, effekt now fails with code 1. If run as REPL or server, errors won't cause exits.

@@ -121,6 +121,10 @@ class EffektConfig(args: Seq[String]) extends REPLConfig(args) {

def interpret(): Boolean = !server() && !compile() && !build()

def repl(): Boolean = filenames().isEmpty && !server() && !compile()

def exitOnError(): Boolean = !repl() && !server()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have a semantic name for this? What characterizes these options? Being in batch mode?

@b-studios
Copy link
Collaborator

In our meeting @marzipankaiser mentioned that this might kill sbt when we use sbt run myfile.effekt and an error occurs (and it actually does).

Copy link
Contributor

@marzipankaiser marzipankaiser left a comment

Choose a reason for hiding this comment

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

Tried it locally on my machine.
It seems to do (close enough to) the right thing for me:

  • running effekt ... terminates with useful error code (1 on error)
  • running sbt, then project effektJVM, then run ... does not terminate shell on error, generates compiled output correctly
  • running sbt "effektJVM/run ..." terminates with useful error code (1 on error)
  • running sbt, then effektJVM/run ... will terminate the sbt shell on error. While this is somewhat unexpected behaviour, I would not run into this in normal use, so I think this is a good compromise for now.

In Summary: LGTM.

@b-studios b-studios merged commit 2ba7d1f into effekt-lang:master Jan 16, 2024
1 check passed
@marvinborner marvinborner deleted the fix/non-zero-exit-code branch January 16, 2024 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants