Comments (3)
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?
https://xon.sh/aliases.html#eof-exit-and-quit
from xonsh.
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(_)
from xonsh.
Solved in #5380. Now $RAISE_SUBPROC_ERROR = True
allows to achieve interrupting.
from xonsh.
Related Issues (20)
- Run tests: `fixture 'xession' not found use 'pytest --fixtures [testpath]' for help on them.` HOT 1
- conda and mamba: `DeprecationWarning: Use xonsh.lib.lazyasd instead of xonsh.lazyasd.` HOT 1
- What is changed after releasing new resolver? HOT 2
- Windows: Comapre typing speed: xonsh 0.16.0 vs 0.18.2 HOT 29
- [docs] Cli command examples in guides should be fully copy&pasteable, i.e., without @
- Completion exception when input ends with `@(` HOT 2
- AUTO_CD broken on 0.18.2 HOT 2
- problems importing case_insensitive_dict HOT 10
- Callable alias can provoke `Bad file descriptor` exception in the internal or external code HOT 21
- git completion only lists the files in the directory, not the commands and the files.
- install from homebrew on macos: Python Icon Jumping on the Dock HOT 8
- $XONSH_SUBPROC_OUTPUT_FORMAT affects downstream apps HOT 1
- Callable alias with subproc commands: upstream redirect ignored in downstream command redirect
- Edge case: callable alias with full capturing and redirect in the middle: `I/O operation on closed file`
- Callable alias: redirect inside uncaptured operator produces `AttributeError: 'int' object has no attribute 'readable'`
- Windows: No backscroll in Python REPL when running under xonsh HOT 5
- Color highlighting sometimes fails on fast typing
- Unexpected numerical token HOT 1
- Variables shadowing executables should be highlighted green
- installation and configuration options for NixOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xonsh.