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

mettalog Misleading Behavior When File Is Missing #218

Closed
TeamSPoon opened this issue Dec 11, 2024 · 1 comment
Closed

mettalog Misleading Behavior When File Is Missing #218

TeamSPoon opened this issue Dec 11, 2024 · 1 comment

Comments

@TeamSPoon
Copy link
Collaborator

TeamSPoon commented Dec 11, 2024

When running mettalog with a missing .metta file, the program does not clearly indicate what it’s doing. It appears to hang, but in reality, it’s just waiting for input. The output lacks a newline and prompt clarity, making it non-obvious that the program is still running and accepting input.

For example, running:

mettalog missing-file.metta

Produces:

#(in #( : user #(load_metta_file &self missing-file.metta) ) #(error #(missing_exception #(load_metta &self missing-file.metta)) $10000))
|
|
|

Interrupting with Ctrl+C reveals the stack trace, but it’s clear that the program is waiting for input at this point.

Action (h for help) ? goals
     [57] [system] read_string(current_input, '\n', '\r', _1076, _1078)
     [56] [read_util] read_util:read_line_to_string(current_input, _1074)
     [55] [user] repl_read_next("\n\n\n", _930)
     [48] [user] repl_read_next(_930)
     [47] [user] repl_read(_896)
     [46] [system] catch(user:repl_read(_896), stream_error(_900, _902), user:(writeln(_902), throw(restart_reading)))
     [45] [user] repl4
     [44] [user] '<meta-call>'(user:(ttyflush, repl4, ttyflush))
     [43] [system] setup_call_cleanup(user:true, user:(ttyflush, repl4, ttyflush), user:notrace(prompt(_856, '|: ')))
     [41] [system] once(user:repl3)
     [40] [system] catch(user:once(repl3), restart_reading, user:true)
     [39] [system] ignore(user:catch(once(repl3), restart_reading, true))
     [38] [system] catch(user:ignore(catch(once(repl3), restart_reading, true)), give_up(_702), user:pp_m('red', gave_up(_702)))
     [37] [system] ignore(user:catch(ignore(catch(once(repl3), restart_reading, true)), give_up(_702), pp_m('red', gave_up(_702)))),
     ...

Steps to Reproduce:

  1. Run the command mettalog missing-file.metta.
  2. Observe that the program outputs an error message but does not flush the output or indicate that it’s ready for input.
  3. Press Ctrl+C to confirm that the program is still running and waiting for input.

Expected Behavior:

  • The program should flush the output, include a newline, and clearly display the prompt to indicate it is ready for input.
  • A more user-friendly output might look like this:

#(in #( : user #(load_metta_file &self missing-file.metta) ) #(error #(missing_exception #(load_metta &self missing-file.metta)) $10000))
metta+>

Actual Behavior:
The output is confusing, with no indication that the program is waiting for input, leading to the impression that it’s hanging.

Additional Information:

  • This issue makes it difficult for users to understand the program state, especially when handling errors.
  • Adding a newline and flushing the output would significantly improve clarity.

Request:
Please update the program to:

  1. Ensure output is flushed correctly.
  2. Add a newline after error messages or other output.
  3. Clearly display the prompt when waiting for input.
@TeamSPoon TeamSPoon changed the title ### Issue: mettalog Hangs When Running with Missing File ### Issue: mettalog Misleading Behavior When File Is Missing Dec 11, 2024
@TeamSPoon TeamSPoon changed the title ### Issue: mettalog Misleading Behavior When File Is Missing mettalog Misleading Behavior When File Is Missing Dec 11, 2024
@TeamSPoon
Copy link
Collaborator Author

closing this for later..

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

No branches or pull requests

1 participant