zxpy: shell hangs when `echo` is used

So for the following script

#! /usr/bin/env zxpy

~'echo Hello'

once I executed it, the shell hangs after printing Hello. When I press ctrl+c, I get:

^CTraceback (most recent call last):
  File "/usr/local/bin/zxpy", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/site-packages/zx.py", line 59, in cli
    run_zxpy(filename, module)
  File "/usr/local/lib/python3.7/site-packages/zx.py", line 136, in run_zxpy
    "$shlex_quote": shlex.quote,
  File "./bug.py", line 3, in <module>
    ~'echo Hello'
  File "/usr/local/lib/python3.7/site-packages/zx.py", line 100, in run_shell_print
    sys.stdout.buffer.write(text)
KeyboardInterrupt

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

I’m guessing you updated it on one python version but not the other?

Anyway, glad that it’s fixed now.

I found a few things about it:

  1. it only happens on macos. Probably why I didn’t catch this issue in my tests.

  2. it has to do with my polling mechanism. It’s not hanging on any single statement, it’s stuck in an infinite loop. If you try to ctrl+C many times, you’ll find that it reports a different line every time.

I’ll try and fix this ASAP, and keep you updated.