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

On h.quit() terminal settings are same as when neuron.hoc was imported. #3259

Merged
merged 8 commits into from
Dec 3, 2024

Conversation

nrnhines
Copy link
Member

On h.quit() ensure terminal settings are same as when neuron.hoc was imported. This is most important with
NEURONMainMenu/File/Quit which would leave terminal in raw readline state with no input echoing and no return before linefeed when newline was printed. I.e. Consider the following when at the prompt, NEURONMainMenu/File/Quit is selected, and on exit, stty is typed at the terminal shell $ prompt (no echoing of stty)

$ python -i -c 'from neuron import h, gui'
>>> hines@hines-ThinkStation-P5:~/neuron/sane/bld$ 
speed 38400 baud; line = 0;
                           min = 1; time = 0;
                                             -imaxbel iutf8
                                                           -opost
                                                                 -icanon -iexten -echo

@nrnhines nrnhines requested a review from JCGoran November 29, 2024 18:20
Copy link

✔️ dd7514a -> Azure artifacts URL

Copy link

codecov bot commented Nov 29, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 67.08%. Comparing base (e0ab555) to head (6309927).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/nrnpython/inithoc.cpp 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3259      +/-   ##
==========================================
- Coverage   67.08%   67.08%   -0.01%     
==========================================
  Files         571      571              
  Lines      111116   111116              
==========================================
- Hits        74540    74539       -1     
- Misses      36576    36577       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 1c58958 -> Azure artifacts URL

@nrnhines
Copy link
Member Author

nrnhines commented Nov 29, 2024

@JCGoran I believe this prevents NEURONMainMenu/File/Quit from leaving the terminal in the raw input state (h.quit when python 3.13 readline is waiting for input). That problem was in both Linux and Macosx. When this is merged, I will look further into #3243

@bbpbuildbot

This comment has been minimized.

@nrnhines nrnhines enabled auto-merge (squash) November 29, 2024 20:42
@nrnhines nrnhines disabled auto-merge November 29, 2024 20:48
@nrnhines nrnhines enabled auto-merge (squash) November 29, 2024 20:51
src/nrnpython/inithoc.cpp Show resolved Hide resolved
src/nrnpython/inithoc.cpp Outdated Show resolved Hide resolved
@nrnhines nrnhines disabled auto-merge November 30, 2024 16:47
Copy link

✔️ c8c5b7b -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 8ed8314 -> Azure artifacts URL

Copy link

sonarcloud bot commented Dec 2, 2024

Copy link

✔️ 6309927 -> Azure artifacts URL

@JCGoran
Copy link
Collaborator

JCGoran commented Dec 3, 2024

I think part of this was merged in #3243, but I guess the new isatty check is needed?

@nrnhines
Copy link
Member Author

nrnhines commented Dec 3, 2024

I think part of this was merged in #3243, but I guess the new isatty check is needed?

The check is needed to prevent an irrelevant error message(s) when stdin is not a terminal. For example, at the moment with the current master

$ echo 'from neuron import h;print("hello");h.quit()' | python
Error getting original terminal attributes
hello
Error restoring terminal attributes
$ 

Copy link
Collaborator

@JCGoran JCGoran left a comment

Choose a reason for hiding this comment

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

Can confirm that this fixes the issue when we don't use stdin as input, so it's good to go.

@nrnhines nrnhines merged commit 6dfdc4a into master Dec 3, 2024
36 checks passed
@nrnhines nrnhines deleted the hines/set-terminal-sane branch December 3, 2024 13:46
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.

3 participants