karan / joe

:running: A .gitignore magician in your command line

Home Page:http://karan.github.io/joe/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect output on broken pipe

jakubtuchol opened this issue · comments

I'm currently running joe-0.0.6. When you pipe joe to a command that doesn't exist, you get the following behavior:

$ joe java | hello
-bash: hello: command not found
close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr

I looked into this behavior, and it turns out to be a bug in the Python 2.7 interpreter: the interpreter is not reporting an exception when failing to flush stdout. More about this can be found here and here.

I believe this behavior can be fixed by simply adding sys.stdout.flush() to the bottom of the main method.