Skip to content

Clarinet console breaks when it is panicked #541

Closed

Description

Improvement Request

Problem :
I am learning clarity, and console is my Number 1 tool to use, but when I make an mistake, Rust code panics, terminates the console and exits to the shell... This is really annoying.

Example screen :

$ clarinet console
clarity-repl v0.33.0
Enter "::help" for usage hints.
Connected to a transient in-memory database.

>> (/ 0 0)
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Runtime(DivisionByZero, Some([]))', components/clarity-repl/src/repl/interpreter.rs:516:89
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: no manifest found. Continuing with default.

$

Desire behavior :
Console should handle Rust runtime errors, reports to user properly, and not exit to shell.

Work around:
Current work around I came up is to write a While loop to check the exit code... So, It re-runs the clarinet console infinitely unless user exits. Here is the script

clarinet console
while [ $? -ne 0 ]
do
   clarinet console
done

one line version

clarinet console; while [ $? -ne 0 ]; do clarinet console; done

and as an alias

alias clarinet-console='clarinet console; while [ $? -ne 0 ]; do clarinet console; done'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions