Skip to content

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

Merged
nrnhines merged 8 commits into
masterfrom
hines/set-terminal-sane
Dec 3, 2024
Merged

On h.quit() terminal settings are same as when neuron.hoc was imported.#3259
nrnhines merged 8 commits into
masterfrom
hines/set-terminal-sane

Conversation

@nrnhines

Copy link
Copy Markdown
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
@azure-pipelines

Copy link
Copy Markdown

✔️ dd7514a -> Azure artifacts URL

@codecov

codecov Bot commented Nov 29, 2024

Copy link
Copy Markdown

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.

@azure-pipelines

Copy link
Copy Markdown

✔️ 1c58958 -> Azure artifacts URL

@nrnhines

nrnhines commented Nov 29, 2024

Copy link
Copy Markdown
Member Author

@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
Comment thread src/nrnpython/inithoc.cpp
Comment thread src/nrnpython/inithoc.cpp Outdated
@nrnhines nrnhines disabled auto-merge November 30, 2024 16:47
@azure-pipelines

Copy link
Copy Markdown

✔️ c8c5b7b -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

@azure-pipelines

Copy link
Copy Markdown

✔️ 8ed8314 -> Azure artifacts URL

@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2024

Copy link
Copy Markdown

@azure-pipelines

Copy link
Copy Markdown

✔️ 6309927 -> Azure artifacts URL

@JCGoran

JCGoran commented Dec 3, 2024

Copy link
Copy Markdown
Collaborator

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

@nrnhines

nrnhines commented Dec 3, 2024

Copy link
Copy Markdown
Member Author

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
$ 

@JCGoran JCGoran left a comment

Copy link
Copy Markdown
Collaborator

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
@nrnhines nrnhines deleted the hines/set-terminal-sane branch December 3, 2024 13:46
nrnhines added a commit that referenced this pull request Mar 16, 2025
…d. (#3259)


* Print tcgetatt/tcsetattr error messages only if STDIN is a tty.
nrnhines added a commit that referenced this pull request Mar 21, 2025
…d. (#3259)


* Print tcgetatt/tcsetattr error messages only if STDIN is a tty.
nrnhines added a commit that referenced this pull request Mar 24, 2025
At starting point, jelic/8.2-py313 #3319 had only two CI failures.

Almost the entirety of this PR is to get 8.2 to pass CI.
In addition it supports Python3.13.
Bug fixes adopted from the master are
#3239 Launching nrniv -python with Python 3.13.0 does not allow use of gui.
#3259 On h.quit() terminal settings are same as when neuron.hoc was imported.
#3243 save stdin terminal settings on import hoc and restore on h.quit()
#3276 Python 3.13.1 broke [s for s in sl] where sl is a SectionList. Manual partial cherry-pick.

Other PR attempts at fixing CI failures that can be closed when this PR is merged, are #3329 #3325 #3319 #3317

Many of the CI fixes are backports from #3028 #3040 #3303 #3105 #3278

bldnrnmacpkgcmake.sh was updated. It isolates a change (avoid breaking CI) with -DNRN_MAC_PKG=ON
---------

Co-authored-by: Goran Jelic-Cizmek <goran.jelic-cizmek@epfl.ch>
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