-
-
Notifications
You must be signed in to change notification settings - Fork 628
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
Case with endless loop with no way to interrupt #5304
Comments
If this outer loop is run in xonsh, even if Ctrl+D quits the inner sleep process, the outer while loop will then immediately start another one. With fortunate timing and luck, perhaps it's rarely possible to quit the outer loop if the interrupt is processed just after the inner process ends and just before the next one starts. while 1:
xonsh -c 'date; sleep 1' Is the idea to pass an interrupt from a xonsh process, to its calling process? |
I think this functionality might even already exist. Or at the very least I can't reproduce the failure. Admittedly it can cause the outer interactive xonsh to hang, but I was able to quit the loop in MINGW64 Git Bash on Windows by simply spamming (not holding down) Ctrl+C: @LAPTOP ~ @ while 1:
......................... xonsh -c 'date; sleep 1'
.........................
Sun, Mar 17, 2024 12:01:35 PM
Sun, Mar 17, 2024 12:01:37 PM
Sun, Mar 17, 2024 12:01:39 PM
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\\.local\bin\xonsh.exe\__main__.py", line 4, in <module>
File "C:\Users\\.local\pipx\venvs\xonsh\Lib\site-packages\xonsh\main.py", line 2, in <module>
import argparse
File "C:\Users\\AppData\Local\Programs\Python\Python311\Lib\argparse.py", line 94, in <module>
from gettext import gettext as _, ngettext
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1138, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1078, in _find_spec
File "<frozen importlib._bootstrap_external>", line 1504, in find_spec
File "<frozen importlib._bootstrap_external>", line 1476, in _get_spec
File "<frozen importlib._bootstrap_external>", line 1612, in find_spec
File "<frozen importlib._bootstrap_external>", line 147, in _path_stat
KeyboardInterrupt
@LAPTOP-~ @
@LAPTOP-~ @ print(_)
|
Solved in #5380. Now |
### Before Case 1: Handler catches the exit signal and do not pass it forward. As result xonsh could be suspended by OS or crash. Also exit code is wrong. See repeatable examples with SIGHUP in #5381 (comment). Case 2: From bash/zsh as login shell run xonsh. Then send quit signal to xonsh. The terminal state will be broken: disabled SIGINT, mouse pointer produces mouse state codes. ### After Case 1: Xonsh exit normally with right exit code. Fixed #5381 #5304 #5371. Case 2: After exiting with right exit code the state of the terminal is good. ## For community ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sometimes I'm facing with loops without the way to interrupt it (MacOS):
We need to add the way to stop the execution.
For community
⬇️ Please click the 👍 reaction instead of leaving a
+1
or 👍 commentThe text was updated successfully, but these errors were encountered: