Skip to content

Commit dc4354d

Browse files
committed
Fix use of unqualified exit() function in view server (issue djc#7). Thanks to Noah Slater for the patch.
--HG-- extra : convert_revision : svn%3A7a298fb0-333a-0410-83e7-658617cd9cf3/trunk%4066
1 parent 93ac125 commit dc4354d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

couchdb/view.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ def map_doc(doc):
9595
except ValueError, e:
9696
sys.stderr.write('error: %s\n' % e)
9797
sys.stderr.flush()
98-
exit(1)
98+
return 1
9999
else:
100100
retval = handlers[cmd[0]](*cmd[1:])
101101
output.write(json.dumps(retval))
102102
output.write('\n')
103103
output.flush()
104104
except KeyboardInterrupt:
105-
exit(0)
105+
return 0
106106

107107
_VERSION = """%(name)s - CouchDB Python %(version)s
108108
@@ -139,15 +139,15 @@ def main():
139139
if message:
140140
sys.stdout.write(message)
141141
sys.stdout.flush()
142-
exit(0)
142+
sys.exit(0)
143143
except getopt.GetoptError, error:
144144
message = '%s\n\nTry `%s --help` for more information.\n' % (
145145
str(error), os.path.basename(sys.argv[0])
146146
)
147147
sys.stderr.write(message)
148148
sys.stderr.flush()
149-
exit(1)
150-
run()
149+
sys.exit(1)
150+
sys.exit(run())
151151

152152
if __name__ == '__main__':
153153
main()

0 commit comments

Comments
 (0)