question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

shell hangs when `echo` is used

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
tusharsadhwanicommented, Oct 20, 2021

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

Anyway, glad that it’s fixed now.

1reaction
tusharsadhwanicommented, Oct 18, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shell hangs when assigning command result to a variable
-- you are using command substitution, so as long as the command has not finished execution, substitution cannot be done, because the output...
Read more >
bash - simple cat echo process substitution hangs
Your code cat >( echo hola; ) will never get exit because,. it will first echo the pattern hola; And takes the input...
Read more >
Echo command hangs when writing to serial device
No prompt appears for approximately 40 seconds, terminal seems to be hanging. What could be the reason for this behaviour? P.S. The serial...
Read more >
Weird tee command hang - Korn Shell - Google Groups
I have a small driver Korn Shell program that I use to call programs on my system. ... echo "ERROR: Problems detected with...
Read more >
Shell Scripting Crash Course | Linux Certification Training
Linux Admin Certification Training ( Use Code "YOUTUBE20"): https://www.edureka.co/linux-admin Edureka Computer Science Bootcamp ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found