mirror of https://github.com/apache/cassandra
cqlsh should return a non-zero error code if a query fails
patch by Branden Visser and Mikhail Stepura; reviewed by Mikhail Stepura for CASSANDRA-6344
This commit is contained in:
parent
d839350f42
commit
8abe9f6f52
|
|
@ -23,6 +23,7 @@
|
|||
* remove duplicate query for local tokens (CASSANDRA-7182)
|
||||
* raise streaming phi convict threshold level (CASSANDRA-7063)
|
||||
* reduce garbage creation in calculatePendingRanges (CASSANDRA-7191)
|
||||
* exit CQLSH with error status code if script fails (CASSANDRA-6344)
|
||||
|
||||
1.2.16
|
||||
* Add UNLOGGED, COUNTER options to BATCH documentation (CASSANDRA-6816)
|
||||
|
|
|
|||
|
|
@ -548,6 +548,7 @@ class Shell(cmd.Cmd):
|
|||
self.show_line_nums = True
|
||||
self.stdin = stdin
|
||||
self.query_out = sys.stdout
|
||||
self.statement_error = False
|
||||
|
||||
def set_expanded_cql_version(self, ver):
|
||||
ver, vertuple = full_cql_version(ver)
|
||||
|
|
@ -2175,6 +2176,7 @@ class Shell(cmd.Cmd):
|
|||
self.query_out.flush()
|
||||
|
||||
def printerr(self, text, color=RED, newline=True, shownum=None):
|
||||
self.statement_error = True
|
||||
if shownum is None:
|
||||
shownum = self.show_line_nums
|
||||
if shownum:
|
||||
|
|
@ -2404,6 +2406,8 @@ def main(options, hostname, port):
|
|||
|
||||
shell.cmdloop()
|
||||
save_history()
|
||||
if options.file and shell.statement_error:
|
||||
sys.exit(2)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(*read_options(sys.argv[1:], os.environ))
|
||||
|
|
|
|||
Loading…
Reference in New Issue