Giter Club home page Giter Club logo

Comments (3)

JamesParrott avatar JamesParrott commented on September 28, 2024

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.

JamesParrott avatar JamesParrott commented on September 28, 2024

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.

anki-code avatar anki-code commented on September 28, 2024

Solved in #5380. Now $RAISE_SUBPROC_ERROR = True allows to achieve interrupting.

from xonsh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.