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

Pretty display of error unpauses terminal #875

Closed
dragoncoder047 opened this issue Apr 17, 2023 · 4 comments
Closed

Pretty display of error unpauses terminal #875

dragoncoder047 opened this issue Apr 17, 2023 · 4 comments
Labels
Bug resolved if issue is resolved, it will be open until merge with master

Comments

@dragoncoder047
Copy link

Issue summary

when term::exception() is used to pretty print the JS error, it allows the user to see the source code of the error by clicking on the file names in the stack trace. But when they do this it enables the terminal regardless of whether the app called term::pause()

Expected behavior

If term::pause() has been called, the prompt will not re-appear when the user clicks the traceback links

Actual behavior

When the user clicks the traceback links, the prompt re-appears

Steps to reproduce

  1. https://jsfiddle.net/cpfe3ray/
  2. Click the link for one of the jQuery frames
  3. Prompt reappears below traceback frame
  4. You can type at the prompt and the command function is called

Browser and OS

Chrome 108 64-bit on a chromebook.

Additional notes

I am using this library for a programming language interpreter, when the interpreter suffers a fatal error it is supposed to show the traceback using term::exception() and then block the user from entering anything else. But when they click the traceback they get a prompt back and then when they try to enter anything it causes the page to hang.

@jcubic
Copy link
Owner

jcubic commented Apr 17, 2023

So am I understanding correctly you want to be in the state where you never get out of pause if you call term::exception? This happens when an error happens, which means that something wrong is with the app. It probably will never get the chance to call resume, so the terminal will be broken until the user refreshes the page.

Removing the term::resume() call from term::exception() which was added for a reason, will probably break a lot of code including a lot of unit tests.

@jcubic
Copy link
Owner

jcubic commented Apr 17, 2023

Just read the note a the end. I think that the reason why it calls resume() is because it calls pause() before fetching the page to the source code of the file. It should check if the terminal was passed before the AJAX call, and call the resume only when the terminal was not paused.

jcubic added a commit that referenced this issue Apr 24, 2023
@jcubic
Copy link
Owner

jcubic commented Apr 24, 2023

Added a fix. So a call to resume after Ajax call only when there was no pause before the call.

@jcubic jcubic added the resolved if issue is resolved, it will be open until merge with master label Apr 24, 2023
@dragoncoder047
Copy link
Author

Great, just checked with bleeding edge version (https://cdn.jsdelivr.net/gh/jcubic/jquery.terminal@devel/js/jquery.terminal.min.js) and it works good.

@jcubic jcubic closed this as completed May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug resolved if issue is resolved, it will be open until merge with master
Projects
None yet
Development

No branches or pull requests

2 participants