Will happen if piping through a pager like less, that closes stdout before everything has been printed. Related: #47main
parent
2ba435126d
commit
5ca090668f
@ -1,5 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
import sys
|
||||
|
||||
from pubs import pubs_cmd
|
||||
pubs_cmd.execute()
|
||||
|
||||
try:
|
||||
pubs_cmd.execute()
|
||||
except IOError:
|
||||
# stdout or stderr has been closed, cleaning up
|
||||
try:
|
||||
sys.stdout.close()
|
||||
except IOError:
|
||||
pass
|
||||
try:
|
||||
sys.stderr.close()
|
||||
except IOError:
|
||||
pass
|
||||
|
Loading…
Reference in new issue