1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-06 23:53:39 +02:00

- globally ignore broken pipe

This commit is contained in:
Marcus Huewe
2011-01-22 16:41:06 +01:00
parent 1491dd4f4b
commit 09b323c2d3
2 changed files with 10 additions and 8 deletions

View File

@@ -126,6 +126,12 @@ def run(prg):
print >>sys.stderr, 'Failed to reach a server:\n', e.reason
return 1
except IOError, e:
# ignore broken pipe
if e.errno != 32:
raise
return 1
except (oscerr.ConfigError, oscerr.NoConfigfile), e:
print >>sys.stderr, e.msg
return 1
@@ -160,6 +166,7 @@ def run(prg):
'and the following traceback to it:'
print >>sys.stderr, e.msg
traceback.print_exc(file=sys.stderr)
return 1
except oscerr.PackageError, e:
print >>sys.stderr, e.msg

View File

@@ -5721,7 +5721,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
query['rev'] = show_upstream_srcmd5(apiurl, args[0], args[1], expand=True, revision=opts.revision)
u = makeurl(apiurl, ['source', args[0], args[1], args[2]], query=query)
try:
if subcmd == "less":
if subcmd == 'less':
f = http_GET(u)
run_pager(''.join(f.readlines()))
else:
@@ -5736,16 +5736,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
f = http_GET(u)
run_pager(''.join(f.readlines()))
else:
try:
for data in streamfile(u):
sys.stdout.write(data)
except IOError, e:
pass # Ignore broken pipe, i.e. when used like 'osc cat foo | head'
for data in streamfile(u):
sys.stdout.write(data)
else:
e.osc_msg = 'If linked, try: cat -e'
raise e
except IOError, e:
pass # Ignore broken pipe, i.e. when used like 'osc cat foo | head'
# helper function to download a file from a specific revision