You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jordan West (Jira)" <ji...@apache.org> on 2020/04/06 20:16:00 UTC
[jira] [Commented] (CASSANDRA-15623) When running CQLSH with STDIN
input, exit with error status code if script fails
[ https://issues.apache.org/jira/browse/CASSANDRA-15623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17076628#comment-17076628 ]
Jordan West commented on CASSANDRA-15623:
-----------------------------------------
[~plastikat] thanks for reworking the patch for trunk. The changes LGTM. I verified the new behavior works as expected and the old behavior remains unchanged:
```
Jordans-MacBook-Pro-2:cassandra-15623-review jordanwest$ echo 'select * from foo;' | ./bin/cqlsh
<stdin>:2:InvalidRequest: Error from server: code=2200 [Invalid query] message="No keyspace has been specified. USE a keyspace, or explicitly specify keyspace.tablename"
Jordans-MacBook-Pro-2:cassandra-15623-review jordanwest$ echo $?
2
Jordans-MacBook-Pro-2:cassandra-15623-review jordanwest$ echo 'select * from;' | ./bin/cqlsh
<stdin>:2:SyntaxException: line 1:13 no viable alternative at input ';' (select * from[;])
Jordans-MacBook-Pro-2:cassandra-15623-review jordanwest$ echo $?
2
Jordans-MacBook-Pro-2:cassandra-15623-review jordanwest$ ./bin/cqlsh -e 'select;'
<stdin>:1:SyntaxException: line 1:6 no viable alternative at input ';' (select[;])
Jordans-MacBook-Pro-2:cassandra-15623-review jordanwest$ echo $?
2
Jordans-MacBook-Pro-2:cassandra-15623-review jordanwest$ ./bin/cqlsh -f testcql
testcql:2:SyntaxException: line 1:6 no viable alternative at input ';' (select[;])
Jordans-MacBook-Pro-2:cassandra-15623-review jordanwest$ echo $?
2
```
I did however notice a new bug that also exists on trunk (unrelated to this change) while testing. More to come on that.
> When running CQLSH with STDIN input, exit with error status code if script fails
> --------------------------------------------------------------------------------
>
> Key: CASSANDRA-15623
> URL: https://issues.apache.org/jira/browse/CASSANDRA-15623
> Project: Cassandra
> Issue Type: Bug
> Components: Legacy/Tools
> Reporter: Jacob Becker
> Assignee: Jacob Becker
> Priority: Normal
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Assuming CASSANDRA-6344 is in place for years and considering that scripts submitted with the `-e` option behave in a similar fashion, it is very surprising that scripts submitted to STDIN (i.e. piped in) always exit with a zero code, regardless of errors. I believe this should be fixed.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org